diff options
author | gabi beyer <gabrielle.n.beyer@intel.com> | 2019-09-04 20:10:16 +0000 |
---|---|---|
committer | gabi beyer <gabib@live.com> | 2019-09-12 21:01:43 +0000 |
commit | 69c58236aed8496ac382aec756086aa14c741353 (patch) | |
tree | 63a6a065eae33ac7d512a6ebbe779ba0431b03fa /test | |
parent | 6ad17623d5361e1970070db667ae710fcc67fa82 (diff) | |
download | podman-69c58236aed8496ac382aec756086aa14c741353.tar.gz podman-69c58236aed8496ac382aec756086aa14c741353.tar.bz2 podman-69c58236aed8496ac382aec756086aa14c741353.zip |
fix unit test to use Expect
The Expect function does not return a result of True or False
depending on the value of the first instance, but instead requires
a comparison using ".To(", so change to use ".To(ContainSubstring("
Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/run_cleanup_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go index 86790e726..99d0d55e5 100644 --- a/test/e2e/run_cleanup_test.go +++ b/test/e2e/run_cleanup_test.go @@ -4,7 +4,6 @@ package integration import ( "os" - "strings" . "github.com/containers/libpod/test/utils" . "github.com/onsi/ginkgo" @@ -36,6 +35,8 @@ var _ = Describe("Podman run exit", func() { }) It("podman run -d mount cleanup test", func() { + SkipIfRootless() + result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"}) result.WaitWithDefaultTimeout() cid := result.OutputToString() @@ -43,25 +44,30 @@ var _ = Describe("Podman run exit", func() { mount := SystemExec("mount", nil) Expect(mount.ExitCode()).To(Equal(0)) - Expect(strings.Contains(mount.OutputToString(), cid)) + Expect(mount.OutputToString()).To(ContainSubstring(cid)) pmount := podmanTest.Podman([]string{"mount", "--notruncate"}) pmount.WaitWithDefaultTimeout() - Expect(strings.Contains(pmount.OutputToString(), cid)) Expect(pmount.ExitCode()).To(Equal(0)) + Expect(pmount.OutputToString()).To(ContainSubstring(cid)) stop := podmanTest.Podman([]string{"stop", cid}) stop.WaitWithDefaultTimeout() Expect(stop.ExitCode()).To(Equal(0)) + // We have to force cleanup so the unmount happens + podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid}) + podmanCleanupSession.WaitWithDefaultTimeout() + Expect(podmanCleanupSession.ExitCode()).To(Equal(0)) + mount = SystemExec("mount", nil) Expect(mount.ExitCode()).To(Equal(0)) - Expect(!strings.Contains(mount.OutputToString(), cid)) + Expect(mount.OutputToString()).NotTo(ContainSubstring(cid)) pmount = podmanTest.Podman([]string{"mount", "--notruncate"}) pmount.WaitWithDefaultTimeout() - Expect(!strings.Contains(pmount.OutputToString(), cid)) Expect(pmount.ExitCode()).To(Equal(0)) + Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid)) }) }) |