Skip to content

Commit

Permalink
fix dns resolution on ubuntu
Browse files Browse the repository at this point in the history
ubuntu's dns seems a little odd and requires a fq name in its tests.

Signed-off-by: baude <[email protected]>
  • Loading branch information
baude committed Feb 15, 2021
1 parent 0ab5bfd commit 227c548
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/e2e/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,26 @@ var _ = Describe("Podman network", func() {
defer podmanTest.removeCNINetwork(netName)
Expect(session.ExitCode()).To(BeZero())

interval := time.Duration(250 * time.Millisecond)
for i := 0; i < 6; i++ {
n := podmanTest.Podman([]string{"network", "exists", netName})
n.WaitWithDefaultTimeout()
worked = n.ExitCode() == 0
if worked {
break
}
time.Sleep(interval)
interval *= 2
}

top := podmanTest.Podman([]string{"run", "-dt", "--name=web", "--network=" + netName, "--network-alias=web1", "--network-alias=web2", nginx})
top.WaitWithDefaultTimeout()
Expect(top.ExitCode()).To(BeZero())
interval := time.Duration(250 * time.Millisecond)
interval = time.Duration(250 * time.Millisecond)
// Wait for the nginx service to be running
for i := 0; i < 6; i++ {
// Test curl against the container's name
c1 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web"})
c1 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web"})
c1.WaitWithDefaultTimeout()
worked = c1.ExitCode() == 0
if worked {
Expand All @@ -436,12 +448,12 @@ var _ = Describe("Podman network", func() {

// Nginx is now running so no need to do a loop
// Test against the first alias
c2 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web1"})
c2 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web1"})
c2.WaitWithDefaultTimeout()
Expect(c2.ExitCode()).To(BeZero())

// Test against the second alias
c3 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web2"})
c3 := podmanTest.Podman([]string{"run", "--dns-search", "dns.podman", "--network=" + netName, nginx, "curl", "web2"})
c3.WaitWithDefaultTimeout()
Expect(c3.ExitCode()).To(BeZero())
})
Expand Down

0 comments on commit 227c548

Please sign in to comment.