diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-04-23 09:38:35 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-04-29 09:15:24 -0700 |
commit | 6a586992c117bd34c69ca6747ac0c0f101c6ea89 (patch) | |
tree | 90156ad5bb3e484c361194d6cab1f65f0e5c3c31 /test/e2e/version_test.go | |
parent | 27aa3a7837fa1c5379ff7ca1a9dcd6416b2ac685 (diff) | |
download | podman-6a586992c117bd34c69ca6747ac0c0f101c6ea89.tar.gz podman-6a586992c117bd34c69ca6747ac0c0f101c6ea89.tar.bz2 podman-6a586992c117bd34c69ca6747ac0c0f101c6ea89.zip |
V2 restore podman -v command
* Removed extra spaces and improved error message
* Updated tests to use gomega matchers
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/e2e/version_test.go')
-rw-r--r-- | test/e2e/version_test.go | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index 4d2e14589..e353b9f97 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -7,6 +7,7 @@ import ( "github.com/containers/libpod/version" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman version", func() { @@ -35,54 +36,49 @@ var _ = Describe("Podman version", func() { It("podman version", func() { session := podmanTest.Podman([]string{"version"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2)) - ok, _ := session.GrepString(version.Version) - Expect(ok).To(BeTrue()) + Expect(session).Should(Exit(0)) + Expect(session.Out.Contents()).Should(ContainSubstring(version.Version)) }) It("podman -v", func() { - Skip(v2fail) session := podmanTest.Podman([]string{"-v"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - ok, _ := session.GrepString(version.Version) - Expect(ok).To(BeTrue()) + Expect(session).Should(Exit(0)) + Expect(session.Out.Contents()).Should(ContainSubstring(version.Version)) }) It("podman --version", func() { session := podmanTest.Podman([]string{"--version"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) - ok, _ := session.GrepString(version.Version) - Expect(ok).To(BeTrue()) + Expect(session).Should(Exit(0)) + Expect(session.Out.Contents()).Should(ContainSubstring(version.Version)) }) It("podman version --format json", func() { session := podmanTest.Podman([]string{"version", "--format", "json"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) Expect(session.IsJSONOutputValid()).To(BeTrue()) }) It("podman version --format json", func() { session := podmanTest.Podman([]string{"version", "--format", "{{ json .}}"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) Expect(session.IsJSONOutputValid()).To(BeTrue()) }) It("podman version --format GO template", func() { session := podmanTest.Podman([]string{"version", "--format", "{{ .Client.Version }}"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"version", "--format", "{{ .Server.Version }}"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) session = podmanTest.Podman([]string{"version", "--format", "{{ .Version }}"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).Should(Exit(0)) }) }) |