Documentation
¶
Index ¶
- func SetFeatureGateDuringTest(tb TB, gate featuregate.FeatureGate, f featuregate.Feature, value bool)
- func SetFeatureGateEmulationVersionDuringTest(tb TB, gate featuregate.FeatureGate, ver *version.Version)
- func SetFeatureGateVersionsDuringTest(tb TB, gate featuregate.FeatureGate, emuVer, minCompatVer *version.Version)
- func SetFeatureGatesDuringTest(tb TB, gate featuregate.FeatureGate, features FeatureOverrides)
- type FeatureOverrides
- type TB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetFeatureGateDuringTest ¶
func SetFeatureGateDuringTest(tb TB, gate featuregate.FeatureGate, f featuregate.Feature, value bool)
SetFeatureGateDuringTest sets the specified gate to the specified value for duration of the test. Fails when it detects second call to the same flag or is unable to set or restore feature flag. When disabling a feature, this automatically disables all dependents.
WARNING: Can leak set variable when called in test calling t.Parallel(), however second attempt to set the same feature flag will cause fatal.
Example use:
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.<FeatureName>, true)
func SetFeatureGateEmulationVersionDuringTest ¶ added in v0.31.0
func SetFeatureGateEmulationVersionDuringTest(tb TB, gate featuregate.FeatureGate, ver *version.Version)
featuregatetesting.SetFeatureGateEmulationVersionDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.31"))
func SetFeatureGateVersionsDuringTest ¶ added in v0.35.0
func SetFeatureGateVersionsDuringTest(tb TB, gate featuregate.FeatureGate, emuVer, minCompatVer *version.Version)
featuregatetesting.SetFeatureGateVersionsDuringTest(t, utilfeature.DefaultFeatureGate, version.MustParse("1.31"), version.MustParse("1.31"))
func SetFeatureGatesDuringTest ¶ added in v0.35.0
func SetFeatureGatesDuringTest(tb TB, gate featuregate.FeatureGate, features FeatureOverrides)
SetFeatureGatesDuringTest sets the specified map of feature gate values for duration of the test. Fails when it detects second call to the same flag or is unable to set or restore feature flag. When disabling a feature, this automatically disables all dependents that weren't explicitly set.
WARNING: Can leak set variable when called in test calling t.Parallel(), however second attempt to set the same feature flag will cause fatal.
Example use:
featuregatetesting.SetFeatureGatesDuringTest(t, utilfeature.DefaultFeatureGate, featuregatetesting.FeatureOverrides{
features.<FeatureName>: true,
features.<FeatureName>: false,
})
Types ¶
type FeatureOverrides ¶ added in v0.35.0
type FeatureOverrides = map[featuregate.Feature]bool