Promote CSIMigrationvSphere to GA

This commit is contained in:
Divyen Patel
2022-10-25 10:11:43 -07:00
parent 449c46258b
commit b849c59ade
2 changed files with 24 additions and 58 deletions

View File

@@ -112,62 +112,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
@@ -224,6 +168,28 @@ func TestMigrationFeatureFlagStatus(t *testing.T) {
csiMigrationResult: true,
csiMigrationCompleteResult: true,
},
{
name: "vsphere-volume migration flag enabled and migration-complete flag disabled with CSI migration flag enabled",
pluginName: "kubernetes.io/vsphere-volume",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
csiMigrationEnabled: true,
inTreePluginUnregister: features.InTreePluginvSphereUnregister,
inTreePluginUnregisterEnabled: false,
csiMigrationResult: true,
csiMigrationCompleteResult: false,
},
{
name: "vsphere-volume migration flag enabled and migration-complete flag enabled with CSI migration flag enabled",
pluginName: "kubernetes.io/vsphere-volume",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
csiMigrationEnabled: true,
inTreePluginUnregister: features.InTreePluginvSphereUnregister,
inTreePluginUnregisterEnabled: true,
csiMigrationResult: true,
csiMigrationCompleteResult: true,
},
}
csiTranslator := csitrans.New()
for _, test := range testCases {