summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2020-10-29 15:54:33 -0500
committerbaude <bbaude@redhat.com>2020-11-09 15:08:58 -0600
commitb7b5b6f8e3072530f4c3fc07e5960e54c90729b5 (patch)
tree01352a9b52f5e6cc3b0c78390036010088e3097a /test
parent110a1d8f25c87739afe790ac2bc461937f17222a (diff)
downloadpodman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.gz
podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.bz2
podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.zip
network aliases for container creation
podman can now support adding network aliases when running containers (--network-alias). It requires an updated dnsname plugin as well as an updated ocicni to work properly. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/network_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 9bd16c008..7933580a5 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
+ "time"
"github.com/containers/podman/v2/pkg/rootless"
. "github.com/containers/podman/v2/test/utils"
@@ -351,4 +352,42 @@ var _ = Describe("Podman network", func() {
Expect(lines[0]).To(Equal(netName1))
Expect(lines[1]).To(Equal(netName2))
})
+ It("podman network with multiple aliases", func() {
+ Skip("Until DNSName is updated on our CI images")
+ var worked bool
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ 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)
+ // 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.WaitWithDefaultTimeout()
+ worked = Expect(c1.ExitCode()).To(BeZero())
+ if worked {
+ break
+ }
+ time.Sleep(interval)
+ interval *= 2
+ }
+ Expect(worked).To(BeTrue())
+
+ // 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.WaitWithDefaultTimeout()
+ Expect(c2.ExitCode()).To(BeZero())
+
+ // Test against the second alias
+ c3 := podmanTest.Podman([]string{"run", "--network=" + netName, nginx, "curl", "web2"})
+ c3.WaitWithDefaultTimeout()
+ Expect(c3.ExitCode()).To(BeZero())
+ })
})