Skip to content

Commit c0f4879

Browse files
authored
Merge pull request kubernetes#123557 from iholder101/swap/enhance-swap-functests-serial
[Swap][Tests][KEP2400] Add swap serial stress tests, improve NodeConformance tests and adapt NoSwap behavior
2 parents 834658c + e9b1a5e commit c0f4879

File tree

4 files changed

+394
-93
lines changed

4 files changed

+394
-93
lines changed

test/e2e/framework/skipper/skipper.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ func SkipUnlessAtLeast(value int, minValue int, message string) {
5656
var featureGate featuregate.FeatureGate
5757

5858
// InitFeatureGates must be called in test suites that have a --feature-gates parameter.
59-
// If not called, SkipUnlessFeatureGateEnabled and SkipIfFeatureGateEnabled will
60-
// record a test failure.
59+
// If not called, SkipUnlessFeatureGateEnabled will record a test failure.
6160
func InitFeatureGates(defaults featuregate.FeatureGate, overrides map[string]bool) error {
6261
clone := defaults.DeepCopy()
6362
if err := clone.SetFromMap(overrides); err != nil {
@@ -67,6 +66,16 @@ func InitFeatureGates(defaults featuregate.FeatureGate, overrides map[string]boo
6766
return nil
6867
}
6968

69+
// IsFeatureGateEnabled can be used during e2e tests to figure out if a certain feature gate is enabled.
70+
// This function is dependent on InitFeatureGates under the hood. Therefore, the test must be called with a
71+
// --feature-gates parameter.
72+
func IsFeatureGateEnabled(feature featuregate.Feature) bool {
73+
if featureGate == nil {
74+
framework.Failf("feature gate interface is not initialized")
75+
}
76+
return featureGate.Enabled(feature)
77+
}
78+
7079
// SkipUnlessFeatureGateEnabled skips if the feature is disabled.
7180
//
7281
// Beware that this only works in test suites that have a --feature-gate

test/e2e/nodefeature/nodefeature.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ var (
9797
// TODO: document the feature (owning SIG, when to use this feature for a test)
9898
RuntimeHandler = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("RuntimeHandler"))
9999

100+
// Added to test Swap Feature
101+
// This label should be used when testing KEP-2400 (Node Swap Support)
102+
Swap = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("NodeSwap"))
103+
100104
// TODO: document the feature (owning SIG, when to use this feature for a test)
101105
SidecarContainers = framework.WithNodeFeature(framework.ValidNodeFeatures.Add("SidecarContainers"))
102106

0 commit comments

Comments
 (0)