mirror of
https://github.com/containers/podman.git
synced 2025-06-19 08:09:12 +08:00
e2e tests: clean up antihelpful BeTrue()s
Many ginkgo tests have been written to use this evil form: GrepString("foo") Expect(that to BeTrue()) ...which yields horrible useless messages on failure: false is not true Identify those (automatically, via script) and convert to: Expect(output to ContainSubstring("foo")) ...which yields: "this output" does not contain substring "foo" There are still many BeTrue()s left. This is just a start. This is commit 1 of 2. It includes the script I used, and all changes to *.go are those computed by the script. Commit 2 will apply some manual fixes. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -230,8 +230,7 @@ RUN printenv http_proxy`, ALPINE)
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir})
|
||||
session.Wait(120)
|
||||
Expect(session).Should(Exit(0))
|
||||
ok, _ := session.GrepString("1.2.3.4")
|
||||
Expect(ok).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
|
||||
os.Unsetenv("http_proxy")
|
||||
})
|
||||
|
||||
@ -284,8 +283,7 @@ RUN find /test`, ALPINE)
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "Containerfile", targetSubPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
ok, _ := session.GrepString("/test/dummy")
|
||||
Expect(ok).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/test/dummy"))
|
||||
})
|
||||
|
||||
It("podman remote test container/docker file is not at root of context dir", func() {
|
||||
@ -392,8 +390,7 @@ subdir**`
|
||||
Expect(session).Should(Exit(0))
|
||||
ok, _ := session.GrepString("/testfilter/dummy1")
|
||||
Expect(ok).NotTo(BeTrue())
|
||||
ok, _ = session.GrepString("/testfilter/dummy2")
|
||||
Expect(ok).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/testfilter/dummy2"))
|
||||
ok, _ = session.GrepString("/testfilter/subdir")
|
||||
Expect(ok).NotTo(BeTrue()) //.dockerignore filters both subdir and inside subdir
|
||||
ok, _ = session.GrepString("/testfilter/subdir/dummy3")
|
||||
@ -450,14 +447,10 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
||||
session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", targetSubPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
ok, _ := session.GrepString("/test/dummy")
|
||||
Expect(ok).To(BeTrue())
|
||||
ok, _ = session.GrepString("/test/emptyDir")
|
||||
Expect(ok).To(BeTrue())
|
||||
ok, _ = session.GrepString("/test/dummy-symlink")
|
||||
Expect(ok).To(BeTrue())
|
||||
ok, _ = session.GrepString("SYMLNKOK")
|
||||
Expect(ok).To(BeTrue())
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/test/dummy"))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/test/emptyDir"))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/test/dummy-symlink"))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("SYMLNKOK"))
|
||||
})
|
||||
|
||||
It("podman build --from, --add-host, --cap-drop, --cap-add", func() {
|
||||
|
Reference in New Issue
Block a user