summaryrefslogtreecommitdiff
path: root/test/e2e/build_test.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-11-22 10:54:22 -0700
committerEd Santiago <santiago@redhat.com>2021-11-22 14:37:43 -0700
commit97ab9176f77c4fc9c4413afad4d2dcf5fad824b6 (patch)
treefc67f0c7dd3304489f89fd58742d3c46431eb44a /test/e2e/build_test.go
parent1bfbb28b0365790552483b961b4bd48a69dd8070 (diff)
downloadpodman-97ab9176f77c4fc9c4413afad4d2dcf5fad824b6.tar.gz
podman-97ab9176f77c4fc9c4413afad4d2dcf5fad824b6.tar.bz2
podman-97ab9176f77c4fc9c4413afad4d2dcf5fad824b6.zip
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>
Diffstat (limited to 'test/e2e/build_test.go')
-rw-r--r--test/e2e/build_test.go21
1 files changed, 7 insertions, 14 deletions
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index aca2b831b..420ed929f 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -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() {