Fix deletion protection unit test

The test should not depend on current set of default feature gates, it
should always ensure the ones necessary for the tests are set.
This commit is contained in:
Jan Safranek 2021-11-12 10:45:00 +01:00
parent c98b388a84
commit bb8157d780

View File

@ -678,6 +678,9 @@ func TestAnnealMigrationAnnotations(t *testing.T) {
}
func TestUpdateFinalizer(t *testing.T) {
// This set of tests ensures that protection finalizer is removed when CSI migration is disabled
// and PV controller needs to remove finalizers added by the external-provisioner.
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIMigrationGCE, false)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.HonorPVReclaimPolicy, true)()
const gcePlugin = "kubernetes.io/gce-pd"
const gceDriver = "pd.csi.storage.gke.io"