Skip to content

Commit

Permalink
Fix max-num-spans flag's usage message (jaegertracing#2528)
Browse files Browse the repository at this point in the history
Signed-off-by: albertteoh <albert.teoh@logz.io>
  • Loading branch information
albertteoh authored Oct 1, 2020
1 parent 5062366 commit 45acfd8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/storage/es/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ func addFlags(flagSet *flag.FlagSet, nsConfig *namespaceConfig) {
flagSet.Int(
nsConfig.namespace+suffixMaxNumSpans,
nsConfig.MaxDocCount,
"(deprecated, will be removed in release v1.21.0. Please use es.max-doc-count). "+
"(deprecated, will be removed in release v1.21.0. Please use "+nsConfig.namespace+".max-doc-count). "+
"The maximum number of spans to fetch at a time per query in Elasticsearch. "+
"The lesser of es.max-num-spans and es.max-doc-count will be used if both are set.")
"The lesser of "+nsConfig.namespace+".max-num-spans and "+nsConfig.namespace+".max-doc-count will be used if both are set.")
flagSet.Int64(
nsConfig.namespace+suffixNumShards,
nsConfig.NumShards,
Expand Down
27 changes: 27 additions & 0 deletions plugin/storage/es/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,33 @@ func TestOptionsWithFlags(t *testing.T) {
assert.Equal(t, "test,tags", aux.Tags.Include)
}

func TestMaxNumSpansUsage(t *testing.T) {
testCases := []struct {
namespace string
wantUsage string
}{
{
namespace: "es",
wantUsage: "(deprecated, will be removed in release v1.21.0. Please use es.max-doc-count). " +
"The maximum number of spans to fetch at a time per query in Elasticsearch. " +
"The lesser of es.max-num-spans and es.max-doc-count will be used if both are set.",
},
{
namespace: "es-archive",
wantUsage: "(deprecated, will be removed in release v1.21.0. Please use es-archive.max-doc-count). " +
"The maximum number of spans to fetch at a time per query in Elasticsearch. " +
"The lesser of es-archive.max-num-spans and es-archive.max-doc-count will be used if both are set.",
},
}
for _, tc := range testCases {
t.Run(tc.namespace, func(t *testing.T) {
opts := NewOptions(tc.namespace)
_, command := config.Viperize(opts.AddFlags)
assert.Equal(t, tc.wantUsage, command.Flag(tc.namespace+".max-num-spans").Usage)
})
}
}

func TestMaxDocCount(t *testing.T) {
testCases := []struct {
name string
Expand Down

0 comments on commit 45acfd8

Please sign in to comment.