Skip to content

Commit 79b9795

Browse files
authored
Remove WithUsrPwd (#4600)
1 parent f1fdbe7 commit 79b9795

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

internal/pkg/bulk/setup_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"time"
1616

1717
"github.com/Pallinder/go-randomdata"
18+
"github.com/elastic/go-elasticsearch/v8"
1819
"github.com/elastic/go-ucfg/yaml"
1920
"github.com/rs/xid"
2021

@@ -133,7 +134,11 @@ func SetupBulk(ctx context.Context, t testing.TB, opts ...BulkOpt) Bulk {
133134

134135
// Set up the client with username and password since this test is generic for any index and uses it's own index/mapping
135136
e := getEnvironment()
136-
cli, err := es.NewClient(ctx, &defaultCfg, false, es.WithUsrPwd(e.Username, e.Password))
137+
cli, err := es.NewClient(ctx, &defaultCfg, false, func(config *elasticsearch.Config) {
138+
config.ServiceToken = "" // reset service token
139+
config.Username = e.Username
140+
config.Password = e.Password
141+
})
137142
if err != nil {
138143
t.Fatal(err)
139144
}

internal/pkg/es/client.go

-9
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,6 @@ func WithUserAgent(name string, bi build.Info) ConfigOption {
100100
}
101101
}
102102

103-
// WithUsrPwd is intended to be used by integration tests ONLY!
104-
func WithUsrPwd(usr, pwd string) ConfigOption {
105-
return func(config *elasticsearch.Config) {
106-
config.ServiceToken = "" // reset service token
107-
config.Username = usr
108-
config.Password = pwd
109-
}
110-
}
111-
112103
func InstrumentRoundTripper() ConfigOption {
113104
return func(config *elasticsearch.Config) {
114105
config.Transport = apmelasticsearch.WrapRoundTripper(

0 commit comments

Comments
 (0)