Remove the unit test to enable the feature gate

vSphere CSI Migration feature gate is locked now.
This commit is contained in:
xing-yang 2023-03-14 19:32:21 +00:00
parent eca25d9e12
commit 223a7c5506

View File

@ -91,62 +91,6 @@ func TestIsMigratable(t *testing.T) {
}
}
func TestCheckMigrationFeatureFlags(t *testing.T) {
testCases := []struct {
name string
pluginFeature featuregate.Feature
pluginFeatureEnabled bool
pluginUnregsiterFeature featuregate.Feature
pluginUnregsiterEnabled bool
expectMigrationComplete bool
expectErr bool
}{
{
name: "plugin specific migration feature enabled with plugin unregister disabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: false,
expectMigrationComplete: false,
expectErr: false,
},
{
name: "plugin specific migration feature and plugin unregister disabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: false,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: false,
expectMigrationComplete: false,
expectErr: false,
},
{
name: "all features enabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: true,
expectMigrationComplete: true,
expectErr: false,
},
}
for _, test := range testCases {
t.Run(fmt.Sprintf("Testing %v", test.name), func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginFeatureEnabled)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginUnregsiterFeature, test.pluginUnregsiterEnabled)()
migrationComplete, err := CheckMigrationFeatureFlags(utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginUnregsiterFeature)
if err != nil && test.expectErr == false {
t.Errorf("Unexpected error: %v", err)
}
if err == nil && test.expectErr == true {
t.Errorf("Unexpected validation pass")
}
if migrationComplete != test.expectMigrationComplete {
t.Errorf("Unexpected migrationComplete result. Exp: %v, got %v", test.expectMigrationComplete, migrationComplete)
}
})
}
}
func TestMigrationFeatureFlagStatus(t *testing.T) {
testCases := []struct {
name string