@@ -328,21 +328,17 @@ func startVolumeServer(client clientset.Interface, config TestConfig) *v1.Pod {
328
328
return pod
329
329
}
330
330
331
- // TestCleanup cleans both server and client pods .
332
- func TestCleanup (f * framework.Framework , config TestConfig ) {
331
+ // TestServerCleanup cleans server pod .
332
+ func TestServerCleanup (f * framework.Framework , config TestConfig ) {
333
333
ginkgo .By (fmt .Sprint ("cleaning the environment after " , config .Prefix ))
334
-
335
334
defer ginkgo .GinkgoRecover ()
336
335
337
- cs := f .ClientSet
338
-
339
- err := e2epod .DeletePodWithWaitByName (cs , config .Prefix + "-client" , config .Namespace )
340
- gomega .Expect (err ).To (gomega .BeNil (), "Failed to delete pod %v in namespace %v" , config .Prefix + "-client" , config .Namespace )
341
-
342
- if config .ServerImage != "" {
343
- err := e2epod .DeletePodWithWaitByName (cs , config .Prefix + "-server" , config .Namespace )
344
- gomega .Expect (err ).To (gomega .BeNil (), "Failed to delete pod %v in namespace %v" , config .Prefix + "-server" , config .Namespace )
336
+ if config .ServerImage == "" {
337
+ return
345
338
}
339
+
340
+ err := e2epod .DeletePodWithWaitByName (f .ClientSet , config .Prefix + "-server" , config .Namespace )
341
+ gomega .Expect (err ).To (gomega .BeNil (), "Failed to delete pod %v in namespace %v" , config .Prefix + "-server" , config .Namespace )
346
342
}
347
343
348
344
func runVolumeTesterPod (client clientset.Interface , config TestConfig , podSuffix string , privileged bool , fsGroup * int64 , tests []Test ) (* v1.Pod , error ) {
@@ -479,8 +475,12 @@ func TestVolumeClient(f *framework.Framework, config TestConfig, fsGroup *int64,
479
475
clientPod , err := runVolumeTesterPod (f .ClientSet , config , "client" , false , fsGroup , tests )
480
476
if err != nil {
481
477
framework .Failf ("Failed to create client pod: %v" , err )
482
-
483
478
}
479
+ defer func () {
480
+ e2epod .DeletePodOrFail (f .ClientSet , clientPod .Namespace , clientPod .Name )
481
+ e2epod .WaitForPodToDisappear (f .ClientSet , clientPod .Namespace , clientPod .Name , labels .Everything (), framework .Poll , framework .PodDeleteTimeout )
482
+ }()
483
+
484
484
framework .ExpectNoError (e2epod .WaitForPodRunningInNamespace (f .ClientSet , clientPod ))
485
485
testVolumeContent (f , clientPod , fsGroup , fsType , tests )
486
486
}
0 commit comments