Skip to content

Commit

Permalink
test(config): Add unit-test for comments in arrays (#14875)
Browse files Browse the repository at this point in the history
  • Loading branch information
srebhan authored Feb 22, 2024
1 parent 4dea65d commit 5847e1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ func TestConfig_LoadSingleInput_WithSeparators(t *testing.T) {
require.Equal(t, inputConfig, c.Inputs[0].Config, "Testdata did not produce correct memcached metadata.")
}

func TestConfig_LoadSingleInput_WithCommentInArray(t *testing.T) {
c := config.NewConfig()
require.NoError(t, c.LoadConfig("./testdata/single_plugin_with_comment_in_array.toml"))
require.Len(t, c.Inputs, 1)

input := c.Inputs[0].Input.(*MockupInputPlugin)
require.ElementsMatch(t, input.Servers, []string{"localhost"})
}

func TestConfig_LoadDirectory(t *testing.T) {
c := config.NewConfig()

Expand Down
5 changes: 5 additions & 0 deletions config/testdata/single_plugin_with_comment_in_array.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[[inputs.memcached]]
servers = [
# A comment in the array
"localhost"
]

0 comments on commit 5847e1d

Please sign in to comment.