mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
e2e storage: explain why cleanup is done inside the function
This code must run during the test and thus cannot be moved into DeferCleanup.
This commit is contained in:
parent
f30d1867e6
commit
8168434f0c
@ -539,6 +539,8 @@ func testVolumeClient(f *framework.Framework, config TestConfig, fsGroup *int64,
|
||||
framework.Failf("Failed to create client pod: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
// testVolumeClient might get used more than once per test, therefore
|
||||
// we have to clean up before returning.
|
||||
e2epod.DeletePodOrFail(f.ClientSet, clientPod.Namespace, clientPod.Name)
|
||||
e2epod.WaitForPodToDisappear(f.ClientSet, clientPod.Namespace, clientPod.Name, labels.Everything(), framework.Poll, timeouts.PodDelete)
|
||||
}()
|
||||
@ -572,6 +574,8 @@ func InjectContent(f *framework.Framework, config TestConfig, fsGroup *int64, fs
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
// This pod must get deleted before the function returns becaue the test relies on
|
||||
// the volume not being in use.
|
||||
e2epod.DeletePodOrFail(f.ClientSet, injectorPod.Namespace, injectorPod.Name)
|
||||
e2epod.WaitForPodToDisappear(f.ClientSet, injectorPod.Namespace, injectorPod.Name, labels.Everything(), framework.Poll, timeouts.PodDelete)
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user