Skip to content

Commit

Permalink
change to featuregate command
Browse files Browse the repository at this point in the history
Signed-off-by: danish9039 <[email protected]>
  • Loading branch information
danish9039 committed Jan 18, 2025
1 parent 8c2239a commit a0571a7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
13 changes: 0 additions & 13 deletions .chloggen/feature-command.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions .chloggen/featuregate-command.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
change_type: enhancement

component: otelcol

note: "Add featuregate command to display information about available features"

issues: [11998]

subtext: |
The featuregate command allows users to view detailed information about feature gates
including their status, stage, and description.
change_logs: [user]
6 changes: 3 additions & 3 deletions otelcol/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewCommand(set CollectorSettings) *cobra.Command {
return col.Run(cmd.Context())
},
}
rootCmd.AddCommand(newFeaturesCommand())
rootCmd.AddCommand(newFeatureGateCommand())
rootCmd.AddCommand(newComponentsCommand(set))
rootCmd.AddCommand(newValidateSubCommand(set, flagSet))
rootCmd.Flags().AddGoFlagSet(flagSet)
Expand Down Expand Up @@ -68,9 +68,9 @@ func updateSettingsUsingFlags(set *CollectorSettings, flags *flag.FlagSet) error
return nil
}

func newFeaturesCommand() *cobra.Command {
func newFeatureGateCommand() *cobra.Command {
return &cobra.Command{
Use: "features [feature-id]",
Use: "featuregate [feature-id]",
Short: "Display feature gates information",
Long: "Display information about available feature gates and their status",
RunE: func(_ *cobra.Command, args []string) error {
Expand Down
14 changes: 7 additions & 7 deletions otelcol/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ func Test_UseUnifiedEnvVarExpansionRules(t *testing.T) {
}
}

func TestNewFeaturesCommand(t *testing.T) {
t.Run("list all features", func(t *testing.T) {
cmd := newFeaturesCommand()
func TestNewFeatureGateCommand(t *testing.T) {
t.Run("list all featuregates", func(t *testing.T) {
cmd := newFeatureGateCommand()
require.NotNil(t, cmd)

// Capture stdout
Expand All @@ -185,8 +185,8 @@ func TestNewFeaturesCommand(t *testing.T) {
assert.Contains(t, output, "Stage")
assert.Contains(t, output, "Description")
})
t.Run("specific feature details", func(t *testing.T) {
cmd := newFeaturesCommand()
t.Run("specific featuregate details", func(t *testing.T) {
cmd := newFeatureGateCommand()

// Register a test feature gate in the global registry
featuregate.GlobalRegistry().MustRegister("test.feature", featuregate.StageBeta,
Expand All @@ -210,8 +210,8 @@ func TestNewFeaturesCommand(t *testing.T) {
assert.Contains(t, output, "Stage: Beta")
})

t.Run("non-existent feature", func(t *testing.T) {
cmd := newFeaturesCommand()
t.Run("non-existent featuregate", func(t *testing.T) {
cmd := newFeatureGateCommand()
err := cmd.RunE(cmd, []string{"non.existent.feature"})
require.Error(t, err)
assert.Contains(t, err.Error(), "feature \"non.existent.feature\" not found")
Expand Down

0 comments on commit a0571a7

Please sign in to comment.