Skip to content

Commit

Permalink
Oops! Manual edits to broken tests
Browse files Browse the repository at this point in the history
Commit 2 of 2: there were (still are?) a bunch of string
checks that didn't have a corresponding Expect(). IIUC
that means they were NOPs. Try to identify and fix those.

The first few were caught by Go linting, "ok is defined
but not used". When I realized the problem, I looked for
more using:

    $ ack -A2 LineInOutputStartsWith

...and tediously eyeballing the results, looking for
matches in which the next line was not Expect(). If
test was wrong (e.g. "server" should've been "nameserver"),
fix that.

Also: remove the remove-betrue script. We don't need it
in the repo, I just wanted to preserve it for posterity.

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Nov 22, 2021
1 parent 97ab917 commit 49d63ad
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 60 deletions.
6 changes: 3 additions & 3 deletions test/e2e/containers_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,21 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("search foobar.com")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("search foobar.com")))
})

It("podman run add dns server", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("server 1.2.3.4")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("nameserver 1.2.3.4")))
})

It("podman run add dns option", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("options debug")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("options debug")))
})

It("podman run containers.conf remove all search domain", func() {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/port_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ var _ = Describe("Podman port", func() {
result := podmanTest.Podman([]string{"port", "portcheck"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
result.LineInOutputStartsWith("80/tcp -> 0.0.0.0:")
Expect(result.OutputToStringArray()).To(ContainElement(HavePrefix("80/tcp -> 0.0.0.0:")))
})

It("podman port multiple ports", func() {
Expand Down
48 changes: 0 additions & 48 deletions test/e2e/remove-betrue

This file was deleted.

11 changes: 6 additions & 5 deletions test/e2e/run_dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var _ = Describe("Podman run dns", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("search foobar.com")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("search foobar.com")))
})

It("podman run remove all search domain", func() {
Expand All @@ -57,14 +57,15 @@ var _ = Describe("Podman run dns", func() {
session := podmanTest.Podman([]string{"run", "--dns=1.2.3.4", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("server 1.2.3.4")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("nameserver 1.2.3.4")))

})

It("podman run add dns option", func() {
session := podmanTest.Podman([]string{"run", "--dns-opt=debug", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("options debug")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("options debug")))
})

It("podman run add bad host", func() {
Expand All @@ -77,8 +78,8 @@ var _ = Describe("Podman run dns", func() {
session := podmanTest.Podman([]string{"run", "--add-host=foobar:1.1.1.1", "--add-host=foobaz:2001:db8::68", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
session.LineInOutputStartsWith("1.1.1.1 foobar")
session.LineInOutputStartsWith("2001:db8::68 foobaz")
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("1.1.1.1 foobar")))
Expect(session.OutputToStringArray()).To(ContainElement(HavePrefix("2001:db8::68 foobaz")))
})

It("podman run add hostname", func() {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/run_userns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,17 @@ var _ = Describe("Podman UserNS support", func() {
session := podmanTest.Podman([]string{"run", "--userns=auto:size=500", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
ok, _ := session.GrepString("500")
Expect(session.OutputToString()).To(ContainSubstring("500"))

session = podmanTest.Podman([]string{"run", "--userns=auto:size=3000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
ok, _ = session.GrepString("3000")
Expect(session.OutputToString()).To(ContainSubstring("3000"))

session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=2000:3000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
ok, _ = session.GrepString("3001")
Expect(session.OutputToString()).To(ContainSubstring("3001"))

session = podmanTest.Podman([]string{"run", "--userns=auto", "--user=4000:1000", "alpine", "cat", "/proc/self/uid_map"})
session.WaitWithDefaultTimeout()
Expand Down

0 comments on commit 49d63ad

Please sign in to comment.