Skip to content

Commit d5bc9a4

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#56168 from screeley44/fix-toggle-bug
Automatic merge from submit-queue (batch tested with PRs 55340, 55329, 56168, 56170, 56105). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. fixing issue of feature gate not being turned off properly Fixes kubernetes#56166 Adding proper defer and toggle of feature gate for BlockVolume support
2 parents 5ac4f17 + 74fcd97 commit d5bc9a4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/controller/volume/persistentvolume/binder_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -720,14 +720,9 @@ func TestSyncAlphaBlockVolume(t *testing.T) {
720720
t.Errorf("Failed to enable feature gate for BlockVolume: %v", err)
721721
return
722722
}
723+
defer utilfeature.DefaultFeatureGate.Set("BlockVolume=false")
723724

724725
runSyncTests(t, tests, []*storage.StorageClass{})
725-
726-
err1 := utilfeature.DefaultFeatureGate.Set("BlockVolume=false")
727-
if err1 != nil {
728-
t.Errorf("Failed to disable feature gate for BlockVolume: %v", err)
729-
return
730-
}
731726
}
732727

733728
// Test multiple calls to syncClaim/syncVolume and periodic sync of all

pkg/controller/volume/persistentvolume/index_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,8 @@ func TestAlphaVolumeModeCheck(t *testing.T) {
839839
}
840840
}
841841

842+
// make sure feature gate is turned off
843+
toggleBlockVolumeFeature(false, t)
842844
}
843845

844846
func TestAlphaFilteringVolumeModes(t *testing.T) {
@@ -933,6 +935,9 @@ func TestAlphaFilteringVolumeModes(t *testing.T) {
933935
t.Errorf("Unexpected failure for scenario: %s - %+v", name, err)
934936
}
935937
}
938+
939+
// make sure feature gate is turned off
940+
toggleBlockVolumeFeature(false, t)
936941
}
937942

938943
func TestFindingPreboundVolumes(t *testing.T) {

0 commit comments

Comments
 (0)