Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x](backport #4600) Remove WithUsrPwd #4601

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/pkg/bulk/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"time"

"github.com/Pallinder/go-randomdata"
"github.com/elastic/go-elasticsearch/v8"
"github.com/elastic/go-ucfg/yaml"
"github.com/rs/xid"

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

// Set up the client with username and password since this test is generic for any index and uses it's own index/mapping
e := getEnvironment()
cli, err := es.NewClient(ctx, &defaultCfg, false, es.WithUsrPwd(e.Username, e.Password))
cli, err := es.NewClient(ctx, &defaultCfg, false, func(config *elasticsearch.Config) {
config.ServiceToken = "" // reset service token
config.Username = e.Username
config.Password = e.Password
})
if err != nil {
t.Fatal(err)
}
Expand Down
9 changes: 0 additions & 9 deletions internal/pkg/es/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ func WithUserAgent(name string, bi build.Info) ConfigOption {
}
}

// WithUsrPwd is intended to be used by integration tests ONLY!
func WithUsrPwd(usr, pwd string) ConfigOption {
return func(config *elasticsearch.Config) {
config.ServiceToken = "" // reset service token
config.Username = usr
config.Password = pwd
}
}

func InstrumentRoundTripper() ConfigOption {
return func(config *elasticsearch.Config) {
config.Transport = apmelasticsearch.WrapRoundTripper(
Expand Down
Loading