summaryrefslogtreecommitdiff
path: root/test/e2e/network_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/network_test.go')
-rw-r--r--test/e2e/network_test.go34
1 files changed, 27 insertions, 7 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index d4e1a3698..53521cdc4 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -6,8 +6,8 @@ import (
"strings"
"time"
- "github.com/containers/podman/v2/pkg/rootless"
- . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/podman/v3/pkg/rootless"
+ . "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -150,6 +150,13 @@ var _ = Describe("Podman network", func() {
defer podmanTest.removeCNINetwork(net)
Expect(session.ExitCode()).To(BeZero())
+ // Tests Default Table Output
+ session = podmanTest.Podman([]string{"network", "ls", "--filter", "id=" + netID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ expectedTable := "NETWORK ID NAME VERSION PLUGINS"
+ Expect(session.OutputToString()).To(ContainSubstring(expectedTable))
+
session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(BeZero())
@@ -407,6 +414,7 @@ var _ = Describe("Podman network", func() {
Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2))
})
+
It("podman network with multiple aliases", func() {
var worked bool
netName := "aliasTest" + stringid.GenerateNonCryptoID()
@@ -415,16 +423,28 @@ 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 = Expect(c1.ExitCode()).To(BeZero())
+ worked = c1.ExitCode() == 0
if worked {
break
}
@@ -435,12 +455,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())
})