summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/logs_test.go18
-rw-r--r--test/e2e/network_create_test.go86
-rw-r--r--test/e2e/network_test.go39
-rw-r--r--test/e2e/play_kube_test.go18
-rw-r--r--test/e2e/run_networking_test.go5
-rw-r--r--test/e2e/run_volume_test.go8
-rw-r--r--test/e2e/search_test.go8
7 files changed, 177 insertions, 5 deletions
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index 4214bd50e..a749a86ff 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -337,4 +337,22 @@ var _ = Describe("Podman logs", func() {
Expect(results).To(Exit(0))
Expect(results.OutputToString()).To(Equal("podman podman podman"))
})
+
+ It("Make sure logs match expected length", func() {
+ logc := podmanTest.Podman([]string{"run", "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"})
+ logc.WaitWithDefaultTimeout()
+ Expect(logc).To(Exit(0))
+
+ wait := podmanTest.Podman([]string{"wait", "test"})
+ wait.WaitWithDefaultTimeout()
+ Expect(wait).To(Exit(0))
+
+ results := podmanTest.Podman([]string{"logs", "test"})
+ results.WaitWithDefaultTimeout()
+ Expect(results).To(Exit(0))
+ outlines := results.OutputToStringArray()
+ Expect(len(outlines)).To(Equal(2))
+ Expect(outlines[0]).To(Equal("1\r"))
+ Expect(outlines[1]).To(Equal("2\r"))
+ })
})
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index 21f03901b..cb997d10a 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -177,8 +177,7 @@ var _ = Describe("Podman network create", func() {
})
It("podman network create with name and IPv6 subnet", func() {
- SkipIfRootless("FIXME I believe this should work in rootlessmode")
-
+ SkipIfRootless("FIXME It needs the ip6tables modules loaded")
var (
results []network.NcList
)
@@ -218,12 +217,72 @@ var _ = Describe("Podman network create", func() {
Expect(subnet.Contains(containerIP)).To(BeTrue())
})
+ It("podman network create with name and IPv6 flag (dual-stack)", func() {
+ SkipIfRootless("FIXME It needs the ip6tables modules loaded")
+ var (
+ results []network.NcList
+ )
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:3:2:1::/64", "--ipv6", "newDualStacknetwork"})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+
+ defer podmanTest.removeCNINetwork("newDualStacknetwork")
+
+ // Inspect the network configuration
+ inspect := podmanTest.Podman([]string{"network", "inspect", "newDualStacknetwork"})
+ inspect.WaitWithDefaultTimeout()
+
+ // JSON the network configuration into something usable
+ err := json.Unmarshal([]byte(inspect.OutputToString()), &results)
+ Expect(err).To(BeNil())
+ result := results[0]
+ Expect(result["name"]).To(Equal("newDualStacknetwork"))
+
+ // JSON the bridge info
+ bridgePlugin, err := genericPluginsToBridge(result["plugins"], "bridge")
+ Expect(err).To(BeNil())
+ Expect(bridgePlugin.IPAM.Routes[0].Dest).To(Equal("::/0"))
+ Expect(bridgePlugin.IPAM.Routes[1].Dest).To(Equal("0.0.0.0/0"))
+
+ // Once a container executes a new network, the nic will be created. We should clean those up
+ // best we can
+ defer removeNetworkDevice(bridgePlugin.BrName)
+
+ try := podmanTest.Podman([]string{"run", "-it", "--rm", "--network", "newDualStacknetwork", ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"})
+ try.WaitWithDefaultTimeout()
+
+ _, subnet, err := net.ParseCIDR("fd00:4:3:2:1::/64")
+ Expect(err).To(BeNil())
+ containerIP, _, err := net.ParseCIDR(try.OutputToString())
+ Expect(err).To(BeNil())
+ // Ensure that the IP the container got is within the subnet the user asked for
+ Expect(subnet.Contains(containerIP)).To(BeTrue())
+ // verify the container has an IPv4 address too (the IPv4 subnet is autogenerated)
+ try = podmanTest.Podman([]string{"run", "-it", "--rm", "--network", "newDualStacknetwork", ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
+ try.WaitWithDefaultTimeout()
+ containerIP, _, err = net.ParseCIDR(try.OutputToString())
+ Expect(err).To(BeNil())
+ Expect(containerIP.To4()).To(Not(BeNil()))
+ })
+
It("podman network create with invalid subnet", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/17000", "fail"})
nc.WaitWithDefaultTimeout()
Expect(nc).To(ExitWithError())
})
+ It("podman network create with ipv4 subnet and ipv6 flag", func() {
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/24", "--ipv6", "fail"})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(ExitWithError())
+ })
+
+ It("podman network create with empty subnet and ipv6 flag", func() {
+ nc := podmanTest.Podman([]string{"network", "create", "--ipv6", "fail"})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(ExitWithError())
+ })
+
It("podman network create with invalid IP", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.0/17000", "fail"})
nc.WaitWithDefaultTimeout()
@@ -247,6 +306,29 @@ var _ = Describe("Podman network create", func() {
Expect(ncFail).To(ExitWithError())
})
+ It("podman network create two networks with same subnet should fail", func() {
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", "subnet1"})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork("subnet1")
+
+ ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", "subnet2"})
+ ncFail.WaitWithDefaultTimeout()
+ Expect(ncFail).To(ExitWithError())
+ })
+
+ It("podman network create two IPv6 networks with same subnet should fail", func() {
+ SkipIfRootless("FIXME It needs the ip6tables modules loaded")
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", "subnet1v6"})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork("subnet1v6")
+
+ ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", "subnet2v6"})
+ ncFail.WaitWithDefaultTimeout()
+ Expect(ncFail).To(ExitWithError())
+ })
+
It("podman network create with invalid network name", func() {
nc := podmanTest.Podman([]string{"network", "create", "foo "})
nc.WaitWithDefaultTimeout()
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())
+ })
})
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 1d683e987..7ae474c76 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -959,7 +959,7 @@ var _ = Describe("Podman play kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(0))
- inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .HostConfig.ExtraHosts }}"})
+ inspect := podmanTest.Podman([]string{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostAdd}}"})
inspect.WaitWithDefaultTimeout()
Expect(inspect.ExitCode()).To(Equal(0))
Expect(inspect.OutputToString()).
@@ -1466,4 +1466,20 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
Expect(kube.ExitCode()).To(Equal(125))
Expect(kube.ErrorToString()).To(ContainSubstring(invalidImageName))
})
+
+ It("podman play kube applies log driver to containers", func() {
+ Skip("need to verify images have correct packages for journald")
+ pod := getPod()
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", "--log-driver", "journald", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "'{{ .HostConfig.LogConfig.Type }}'"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring("journald"))
+ })
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index a3cc352b1..e9c1bab21 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -6,6 +6,7 @@ import (
"strings"
. "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/uber/jaeger-client-go/utils"
@@ -601,11 +602,11 @@ var _ = Describe("Podman run networking", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(BeZero())
- net := "dnsNetTest"
+ net := "IntTest" + stringid.GenerateNonCryptoID()
session = podmanTest.Podman([]string{"network", "create", net})
session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
defer podmanTest.removeCNINetwork(net)
+ Expect(session.ExitCode()).To(BeZero())
pod2 := "testpod2"
session = podmanTest.Podman([]string{"pod", "create", "--network", net, "--name", pod2})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 1c8a67123..7c74cea78 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -540,4 +540,12 @@ VOLUME /test/`
session = podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%s:%s:O", mountPath, mountDest), "--mount", fmt.Sprintf("type=tmpfs,target=%s", mountDest), ALPINE})
Expect(session.ExitCode()).To(Not(Equal(0)))
})
+
+ It("same volume in multiple places does not deadlock", func() {
+ volName := "testVol1"
+ session := podmanTest.Podman([]string{"run", "-t", "-i", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ })
})
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 424a191c5..edd2fedad 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -116,6 +116,14 @@ registries = ['{{.Host}}:{{.Port}}']`
Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
})
+ It("podman search format json", func() {
+ search := podmanTest.Podman([]string{"search", "--format", "json", "alpine"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(search.IsJSONOutputValid()).To(BeTrue())
+ Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
+ })
+
It("podman search no-trunc flag", func() {
search := podmanTest.Podman([]string{"search", "--no-trunc", "alpine"})
search.WaitWithDefaultTimeout()