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

Support reloading ES client's password from file #4342

Merged
merged 15 commits into from
Sep 9, 2023
Prev Previous commit
Next Next commit
Add options test
Signed-off-by: haanhvu <haanh6594@gmail.com>
  • Loading branch information
haanhvu committed Apr 28, 2023
commit 3641d673e7df0763a7a176a0e25b3aef7e2d228f
5 changes: 5 additions & 0 deletions plugin/storage/es/options_test.go
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ func TestOptions(t *testing.T) {
primary := opts.GetPrimary()
assert.Empty(t, primary.Username)
assert.Empty(t, primary.Password)
assert.Empty(t, primary.PasswordFilePath)
assert.NotEmpty(t, primary.Servers)
assert.Empty(t, primary.RemoteReadClusters)
assert.Equal(t, int64(5), primary.NumShards)
@@ -41,6 +42,7 @@ func TestOptions(t *testing.T) {
aux := opts.Get("archive")
assert.Equal(t, primary.Username, aux.Username)
assert.Equal(t, primary.Password, aux.Password)
assert.Equal(t, primary.PasswordFilePath, aux.PasswordFilePath)
assert.Equal(t, primary.Servers, aux.Servers)
}

@@ -52,6 +54,7 @@ func TestOptionsWithFlags(t *testing.T) {
"--es.username=hello",
"--es.password=world",
"--es.token-file=/foo/bar",
"--es.password-file=/foo/bar/baz",
"--es.sniffer=true",
"--es.sniffer-tls-enabled=true",
"--es.max-span-age=48h",
@@ -81,7 +84,9 @@ func TestOptionsWithFlags(t *testing.T) {

primary := opts.GetPrimary()
assert.Equal(t, "hello", primary.Username)
assert.Equal(t, "world", primary.Password)
assert.Equal(t, "/foo/bar", primary.TokenFilePath)
assert.Equal(t, "/foo/bar/baz", primary.PasswordFilePath)
assert.Equal(t, []string{"1.1.1.1", "2.2.2.2"}, primary.Servers)
assert.Equal(t, []string{"cluster_one", "cluster_two"}, primary.RemoteReadClusters)
assert.Equal(t, 48*time.Hour, primary.MaxSpanAge)