Merge pull request #98792 from wzshiming/ut/speed-up-persistentvolume

Speed up pkg/controller/volume/persistentvolume unit tests
This commit is contained in:
Kubernetes Prow Robot 2021-02-10 01:06:59 -08:00 committed by GitHub
commit 18605d8814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -713,7 +713,7 @@ func runSyncTests(t *testing.T, tests []controllerTest, storageClasses []*storag
// of volumes/claims with expected claims/volumes and report differences.
// Some limit of calls in enforced to prevent endless loops.
func runMultisyncTests(t *testing.T, tests []controllerTest, storageClasses []*storage.StorageClass, defaultStorageClass string) {
for _, test := range tests {
run := func(t *testing.T, test controllerTest) {
klog.V(4).Infof("starting multisync test %q", test.name)
// Initialize the controller
@ -822,6 +822,13 @@ func runMultisyncTests(t *testing.T, tests []controllerTest, storageClasses []*s
evaluateTestResults(ctrl, reactor.VolumeReactor, test, t)
klog.V(4).Infof("test %q finished after %d iterations", test.name, counter)
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
run(t, test)
})
}
}
// Dummy volume plugin for provisioning, deletion and recycling. It contains