client-go/features: add Set method to envvar impl

Kubernetes-commit: a07654baa54d53d7649e981c0c65eb8d1210e4af
This commit is contained in:
Lukasz Szaszkiewicz
2024-05-22 15:42:47 +02:00
committed by Kubernetes Publisher
parent b92b563c44
commit 98df4f79ac
3 changed files with 173 additions and 37 deletions

View File

@@ -30,6 +30,15 @@ func TestAddFeaturesToExistingFeatureGates(t *testing.T) {
require.Equal(t, defaultKubernetesFeatureGates, fakeFeatureGates.specs)
}
func TestReplaceFeatureGatesWithWarningIndicator(t *testing.T) {
defaultFeatureGates := FeatureGates()
require.Panics(t, func() { defaultFeatureGates.Enabled("Foo") }, "reading an unregistered feature gate Foo should panic")
if !replaceFeatureGatesWithWarningIndicator(defaultFeatureGates) {
t.Error("replacing the default feature gates after reading a value hasn't produced a warning")
}
}
type fakeRegistry struct {
specs map[Feature]FeatureSpec
}