Feature Toggles: Remove DocsURL from FeatureFlag struct (#79774)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Michael Mandrus 2024-01-31 01:25:16 -05:00 committed by GitHub
parent 12d08d5e7d
commit cbd2032aea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 10 deletions

View File

@ -43,9 +43,6 @@ func (fm *FeatureManager) registerFlags(flags ...FeatureFlag) {
if add.Description != "" { if add.Description != "" {
flag.Description = add.Description flag.Description = add.Description
} }
if add.DocsURL != "" {
flag.DocsURL = add.DocsURL
}
if add.Expression != "" { if add.Expression != "" {
flag.Expression = add.Expression flag.Expression = add.Expression
} }

View File

@ -24,7 +24,7 @@ func TestFeatureManager(t *testing.T) {
require.Equal(t, map[string]bool{"a": true}, ft.GetEnabled(context.Background())) require.Equal(t, map[string]bool{"a": true}, ft.GetEnabled(context.Background()))
}) })
t.Run("check description and docs configs", func(t *testing.T) { t.Run("check description and stage configs", func(t *testing.T) {
ft := FeatureManager{ ft := FeatureManager{
flags: map[string]*FeatureFlag{}, flags: map[string]*FeatureFlag{},
} }
@ -35,14 +35,14 @@ func TestFeatureManager(t *testing.T) {
Name: "a", Name: "a",
Description: "second", Description: "second",
}, FeatureFlag{ }, FeatureFlag{
Name: "a", Name: "a",
DocsURL: "http://something", Stage: FeatureStagePrivatePreview,
}, FeatureFlag{ }, FeatureFlag{
Name: "a", Name: "a",
}) })
flag := ft.flags["a"] flag := ft.flags["a"]
require.Equal(t, "second", flag.Description) require.Equal(t, "second", flag.Description)
require.Equal(t, "http://something", flag.DocsURL) require.Equal(t, FeatureStagePrivatePreview, flag.Stage)
}) })
t.Run("check startup false flags", func(t *testing.T) { t.Run("check startup false flags", func(t *testing.T) {

View File

@ -130,9 +130,8 @@ type FeatureFlag struct {
FrontendOnly bool `json:"frontend,omitempty"` // change is only seen in the frontend FrontendOnly bool `json:"frontend,omitempty"` // change is only seen in the frontend
HideFromDocs bool `json:"hideFromDocs,omitempty"` // don't add the values to docs HideFromDocs bool `json:"hideFromDocs,omitempty"` // don't add the values to docs
// These are currently unused // The server must be initialized with the value
DocsURL string `json:"docsURL,omitempty"` RequiresRestart bool `json:"requiresRestart,omitempty"`
RequiresRestart bool `json:"requiresRestart,omitempty"` // The server must be initialized with the value
} }
type UpdateFeatureTogglesCommand struct { type UpdateFeatureTogglesCommand struct {