Speed up pkg/controller/volume/persistentvolume unit tests

This commit is contained in:
wzshiming 2021-02-05 14:55:43 +08:00
parent f5fb1c93db
commit fb518af0fc

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