Skip to content
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
4 changes: 4 additions & 0 deletions .chloggen/otelcol-featuregate-max-args.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
change_type: bug_fix
component: pkg/otelcol
note: The featuregate subcommand now rejects extra positional arguments instead of silently ignoring them.
issues: [14554]
1 change: 1 addition & 0 deletions otelcol/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func newFeatureGateCommand() *cobra.Command {
Use: "featuregate [feature-id]",
Short: "Display feature gates information",
Long: "Display information about available feature gates and their status",
Args: cobra.MaximumNArgs(1),
RunE: func(_ *cobra.Command, args []string) error {
if len(args) > 0 {
found := false
Expand Down
7 changes: 7 additions & 0 deletions otelcol/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,11 @@ func TestNewFeatureGateCommand(t *testing.T) {
require.Error(t, err)
assert.Contains(t, err.Error(), "feature \"non.existent.feature\" not found")
})

t.Run("rejects multiple arguments", func(t *testing.T) {
cmd := newFeatureGateCommand()
cmd.SetArgs([]string{"gate1", "gate2"})
err := cmd.Execute()
require.Error(t, err)
})
}
Loading