@@ -36,7 +36,6 @@ import (
36
36
"time"
37
37
38
38
"github.com/onsi/ginkgo"
39
- "github.com/onsi/gomega"
40
39
)
41
40
42
41
var (
@@ -151,7 +150,7 @@ func (s *subPathTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
151
150
if l .pod != nil {
152
151
ginkgo .By ("Deleting pod" )
153
152
err := framework .DeletePodWithWait (f , f .ClientSet , l .pod )
154
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while deleting pod" )
153
+ framework . ExpectNoError (err , "while deleting pod" )
155
154
l .pod = nil
156
155
}
157
156
@@ -427,20 +426,20 @@ func (s *subPathTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
427
426
ginkgo .By (fmt .Sprintf ("Creating pod %s" , l .pod .Name ))
428
427
removeUnusedContainers (l .pod )
429
428
pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (l .pod )
430
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while creating pod" )
429
+ framework . ExpectNoError (err , "while creating pod" )
431
430
defer func () {
432
431
ginkgo .By (fmt .Sprintf ("Deleting pod %s" , pod .Name ))
433
432
framework .DeletePodWithWait (f , f .ClientSet , pod )
434
433
}()
435
434
436
435
// Wait for pod to be running
437
436
err = framework .WaitForPodRunningInNamespace (f .ClientSet , l .pod )
438
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for pod to be running" )
437
+ framework . ExpectNoError (err , "while waiting for pod to be running" )
439
438
440
439
// Exec into container that mounted the volume, delete subpath directory
441
440
rmCmd := fmt .Sprintf ("rm -r %s" , l .subPathDir )
442
441
_ , err = podContainerExec (l .pod , 1 , rmCmd )
443
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while removing subpath directory" )
442
+ framework . ExpectNoError (err , "while removing subpath directory" )
444
443
445
444
// Delete pod (from defer) and wait for it to be successfully deleted
446
445
})
@@ -713,7 +712,7 @@ func testPodFailSubpathError(f *framework.Framework, pod *v1.Pod, errorMsg strin
713
712
ginkgo .By (fmt .Sprintf ("Creating pod %s" , pod .Name ))
714
713
removeUnusedContainers (pod )
715
714
pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
716
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while creating pod" )
715
+ framework . ExpectNoError (err , "while creating pod" )
717
716
defer func () {
718
717
framework .DeletePodWithWait (f , f .ClientSet , pod )
719
718
}()
@@ -792,17 +791,17 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
792
791
ginkgo .By (fmt .Sprintf ("Creating pod %s" , pod .Name ))
793
792
removeUnusedContainers (pod )
794
793
pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
795
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while creating pod" )
794
+ framework . ExpectNoError (err , "while creating pod" )
796
795
defer func () {
797
796
framework .DeletePodWithWait (f , f .ClientSet , pod )
798
797
}()
799
798
err = framework .WaitForPodRunningInNamespace (f .ClientSet , pod )
800
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for pod to be running" )
799
+ framework . ExpectNoError (err , "while waiting for pod to be running" )
801
800
802
801
ginkgo .By ("Failing liveness probe" )
803
802
out , err := podContainerExec (pod , 1 , fmt .Sprintf ("rm %v" , probeFilePath ))
804
803
e2elog .Logf ("Pod exec output: %v" , out )
805
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while failing liveness probe" )
804
+ framework . ExpectNoError (err , "while failing liveness probe" )
806
805
807
806
// Check that container has restarted
808
807
ginkgo .By ("Waiting for container to restart" )
@@ -824,7 +823,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
824
823
}
825
824
return false , nil
826
825
})
827
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for container to restart" )
826
+ framework . ExpectNoError (err , "while waiting for container to restart" )
828
827
829
828
// Fix liveness probe
830
829
ginkgo .By ("Rewriting the file" )
@@ -836,7 +835,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
836
835
}
837
836
out , err = podContainerExec (pod , 1 , writeCmd )
838
837
e2elog .Logf ("Pod exec output: %v" , out )
839
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while rewriting the probe file" )
838
+ framework . ExpectNoError (err , "while rewriting the probe file" )
840
839
841
840
// Wait for container restarts to stabilize
842
841
ginkgo .By ("Waiting for container to stop restarting" )
@@ -865,7 +864,7 @@ func testPodContainerRestart(f *framework.Framework, pod *v1.Pod) {
865
864
}
866
865
return false , nil
867
866
})
868
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for container to stabilize" )
867
+ framework . ExpectNoError (err , "while waiting for container to stabilize" )
869
868
}
870
869
871
870
func testSubpathReconstruction (f * framework.Framework , pod * v1.Pod , forceDelete bool ) {
@@ -885,27 +884,27 @@ func testSubpathReconstruction(f *framework.Framework, pod *v1.Pod, forceDelete
885
884
ginkgo .By (fmt .Sprintf ("Creating pod %s" , pod .Name ))
886
885
removeUnusedContainers (pod )
887
886
pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
888
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while creating pod" )
887
+ framework . ExpectNoError (err , "while creating pod" )
889
888
890
889
err = framework .WaitForPodRunningInNamespace (f .ClientSet , pod )
891
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for pod to be running" )
890
+ framework . ExpectNoError (err , "while waiting for pod to be running" )
892
891
893
892
pod , err = f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Get (pod .Name , metav1.GetOptions {})
894
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while getting pod" )
893
+ framework . ExpectNoError (err , "while getting pod" )
895
894
896
895
utils .TestVolumeUnmountsFromDeletedPodWithForceOption (f .ClientSet , f , pod , forceDelete , true )
897
896
}
898
897
899
898
func formatVolume (f * framework.Framework , pod * v1.Pod ) {
900
899
ginkgo .By (fmt .Sprintf ("Creating pod to format volume %s" , pod .Name ))
901
900
pod , err := f .ClientSet .CoreV1 ().Pods (f .Namespace .Name ).Create (pod )
902
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while creating volume init pod" )
901
+ framework . ExpectNoError (err , "while creating volume init pod" )
903
902
904
903
err = framework .WaitForPodSuccessInNamespace (f .ClientSet , pod .Name , pod .Namespace )
905
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while waiting for volume init pod to succeed" )
904
+ framework . ExpectNoError (err , "while waiting for volume init pod to succeed" )
906
905
907
906
err = framework .DeletePodWithWait (f , f .ClientSet , pod )
908
- gomega . Expect (err ). ToNot ( gomega . HaveOccurred () , "while deleting volume init pod" )
907
+ framework . ExpectNoError (err , "while deleting volume init pod" )
909
908
}
910
909
911
910
func podContainerExec (pod * v1.Pod , containerIndex int , command string ) (string , error ) {
0 commit comments