summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/common_test.go6
-rw-r--r--test/e2e/containers_conf_test.go12
-rw-r--r--test/e2e/create_test.go32
-rw-r--r--test/e2e/images_test.go14
-rw-r--r--test/e2e/import_test.go2
-rw-r--r--test/e2e/network_connect_disconnect_test.go217
-rw-r--r--test/e2e/network_create_test.go39
-rw-r--r--test/e2e/network_test.go246
-rw-r--r--test/e2e/port_test.go12
-rw-r--r--test/e2e/pull_test.go30
-rw-r--r--test/e2e/run_dns_test.go12
-rw-r--r--test/e2e/run_entrypoint_test.go6
12 files changed, 439 insertions, 189 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index f107fe76b..16d8bb770 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -788,3 +788,9 @@ func generateNetworkConfig(p *PodmanTestIntegration) (string, string) {
return name, path
}
+
+func (p *PodmanTestIntegration) removeCNINetwork(name string) {
+ session := p.Podman([]string{"network", "rm", "-f", name})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeNumerically("<=", 1))
+}
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 906153c0f..866162f7f 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -203,35 +203,35 @@ var _ = Describe("Podman run", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("search foobar.com")
+ session.LineInOutputStartsWith("search foobar.com")
})
It("podman run add dns server", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("server 1.2.3.4")
+ session.LineInOutputStartsWith("server 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.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("options debug")
+ session.LineInOutputStartsWith("options debug")
})
It("podman run containers.conf remove all search domain", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("search")).To(BeFalse())
+ Expect(session.LineInOutputStartsWith("search")).To(BeFalse())
})
It("podman run use containers.conf search domain", func() {
session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("search")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("search")).To(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("foobar.com"))
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
@@ -275,7 +275,7 @@ var _ = Describe("Podman run", func() {
session = podmanTest.Podman([]string{"run", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("search")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("search")).To(BeTrue())
Expect(session.OutputToString()).To(ContainSubstring("foobar.com"))
Expect(session.OutputToString()).To(ContainSubstring("1.2.3.4"))
Expect(session.OutputToString()).To(ContainSubstring("debug"))
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 760345a67..aaf089d97 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "runtime"
"strings"
. "github.com/containers/podman/v2/test/utils"
@@ -644,4 +645,35 @@ var _ = Describe("Podman create", func() {
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
})
+ It("podman create --platform", func() {
+ session := podmanTest.Podman([]string{"create", "--platform=linux/bogus", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ expectedError := "no image found in manifest list for architecture bogus"
+ Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
+
+ session = podmanTest.Podman([]string{"create", "--platform=linux/arm64", "--override-os", "windows", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ expectedError = "--platform option can not be specified with --overide-arch or --override-os"
+ Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
+
+ session = podmanTest.Podman([]string{"create", "-q", "--platform=linux/arm64", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ setup := podmanTest.Podman([]string{"container", "inspect", session.OutputToString()})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ data := setup.InspectContainerToJSON()
+ setup = podmanTest.Podman([]string{"image", "inspect", data[0].Image})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ idata := setup.InspectImageJSON() // returns []inspect.ImageData
+ Expect(len(idata)).To(Equal(1))
+ Expect(idata[0].Os).To(Equal(runtime.GOOS))
+ Expect(idata[0].Architecture).To(Equal("arm64"))
+ })
})
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 4c65a85d5..281b2c313 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -41,8 +41,8 @@ var _ = Describe("Podman images", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
- Expect(session.LineInOuputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
- Expect(session.LineInOuputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
})
It("podman image List", func() {
@@ -50,8 +50,8 @@ var _ = Describe("Podman images", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
- Expect(session.LineInOuputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
- Expect(session.LineInOuputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
})
It("podman images with multiple tags", func() {
@@ -86,8 +86,8 @@ var _ = Describe("Podman images", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
- Expect(session.LineInOuputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
- Expect(session.LineInOuputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/alpine")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("quay.io/libpod/busybox")).To(BeTrue())
})
It("podman empty images list in JSON format", func() {
@@ -278,7 +278,7 @@ WORKDIR /test
It("podman images sort by values", func() {
sortValueTest := func(value string, result int, format string) []string {
f := fmt.Sprintf("{{.%s}}", format)
- session := podmanTest.Podman([]string{"images", "--sort", value, "--format", f})
+ session := podmanTest.Podman([]string{"images", "--noheading", "--sort", value, "--format", f})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(result))
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index 1be4ef920..bd465bf38 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -87,7 +87,7 @@ var _ = Describe("Podman import", func() {
results := podmanTest.Podman([]string{"history", "imported-image", "--format", "{{.Comment}}"})
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(0))
- Expect(results.LineInOuputStartsWith("importing container test message")).To(BeTrue())
+ Expect(results.LineInOutputStartsWith("importing container test message")).To(BeTrue())
})
It("podman import with change flag CMD=<path>", func() {
diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go
new file mode 100644
index 000000000..7cdad9bf2
--- /dev/null
+++ b/test/e2e/network_connect_disconnect_test.go
@@ -0,0 +1,217 @@
+package integration
+
+import (
+ "os"
+
+ . "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/storage/pkg/stringid"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman network connect and disconnect", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+
+ })
+
+ It("bad network name in disconnect should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ dis := podmanTest.Podman([]string{"network", "disconnect", "foobar", "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).ToNot(BeZero())
+
+ })
+
+ It("bad container name in network disconnect should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ dis := podmanTest.Podman([]string{"network", "disconnect", netName, "foobar"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).ToNot(BeZero())
+
+ })
+
+ It("podman network disconnect", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ dis := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).To(BeZero())
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).ToNot(BeZero())
+ })
+
+ It("bad network name in connect should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).ToNot(BeZero())
+
+ })
+
+ It("bad container name in network connect should result in error", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ dis := podmanTest.Podman([]string{"network", "connect", netName, "foobar"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).ToNot(BeZero())
+
+ })
+
+ It("podman connect on a container that already is connected to the network should error", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
+ con.WaitWithDefaultTimeout()
+ Expect(con.ExitCode()).ToNot(BeZero())
+ })
+
+ It("podman network connect", func() {
+ SkipIfRemote("This requires a pending PR to be merged before it will work")
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ // Create a second network
+ newNetName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session = podmanTest.Podman([]string{"network", "create", newNetName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(newNetName)
+
+ connect := podmanTest.Podman([]string{"network", "connect", newNetName, "test"})
+ connect.WaitWithDefaultTimeout()
+ Expect(connect.ExitCode()).To(BeZero())
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+ })
+
+ It("podman network connect when not running", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName)
+
+ ctr := podmanTest.Podman([]string{"create", "--name", "test", ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ dis := podmanTest.Podman([]string{"network", "connect", netName, "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).To(BeZero())
+
+ start := podmanTest.Podman([]string{"start", "test"})
+ start.WaitWithDefaultTimeout()
+ Expect(start.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+ })
+
+ It("podman network disconnect when not running", func() {
+ SkipIfRootless("network connect and disconnect are only rootfull")
+ netName1 := "aliasTest" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", netName1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName1)
+
+ netName2 := "aliasTest" + stringid.GenerateNonCryptoID()
+ session2 := podmanTest.Podman([]string{"network", "create", netName2})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(netName2)
+
+ ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName1 + "," + netName2, ALPINE, "top"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(BeZero())
+
+ dis := podmanTest.Podman([]string{"network", "disconnect", netName1, "test"})
+ dis.WaitWithDefaultTimeout()
+ Expect(dis.ExitCode()).To(BeZero())
+
+ start := podmanTest.Podman([]string{"start", "test"})
+ start.WaitWithDefaultTimeout()
+ Expect(start.ExitCode()).To(BeZero())
+
+ exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).To(BeZero())
+
+ exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
+ exec.WaitWithDefaultTimeout()
+ Expect(exec.ExitCode()).ToNot(BeZero())
+ })
+})
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index cb997d10a..21b3074fc 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -55,12 +55,6 @@ func genericPluginsToPortMap(plugins interface{}, pluginType string) (network.Po
return portMap, err
}
-func (p *PodmanTestIntegration) removeCNINetwork(name string) {
- session := p.Podman([]string{"network", "rm", "-f", name})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeNumerically("<=", 1))
-}
-
func removeNetworkDevice(name string) {
session := SystemExec("ip", []string{"link", "delete", name})
session.WaitWithDefaultTimeout()
@@ -335,4 +329,37 @@ var _ = Describe("Podman network create", func() {
Expect(nc).To(ExitWithError())
})
+ It("podman network create with mtu option", func() {
+ net := "mtu-test"
+ nc := podmanTest.Podman([]string{"network", "create", "--opt", "mtu=9000", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(net)
+
+ nc = podmanTest.Podman([]string{"network", "inspect", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc.OutputToString()).To(ContainSubstring(`"mtu": 9000,`))
+ })
+
+ It("podman network create with vlan option", func() {
+ net := "vlan-test"
+ nc := podmanTest.Podman([]string{"network", "create", "--opt", "vlan=9", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(net)
+
+ nc = podmanTest.Podman([]string{"network", "inspect", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc.ExitCode()).To(BeZero())
+ Expect(nc.OutputToString()).To(ContainSubstring(`"vlan": 9`))
+ })
+
+ It("podman network create with invalid option", func() {
+ net := "invalid-test"
+ nc := podmanTest.Podman([]string{"network", "create", "--opt", "foo=bar", net})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(ExitWithError())
+ })
+
})
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index adcf74f7e..ffc914bc2 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -66,6 +66,65 @@ var _ = Describe("Podman network", func() {
Expect(session.LineInOutputContains(name)).To(BeTrue())
})
+ It("podman network list --filter plugin and name", func() {
+ name, path := generateNetworkConfig(podmanTest)
+ defer removeConf(path)
+
+ session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge", "--filter", "name=" + name})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(name))
+ })
+
+ It("podman network list --filter two names", func() {
+ name1, path1 := generateNetworkConfig(podmanTest)
+ defer removeConf(path1)
+
+ name2, path2 := generateNetworkConfig(podmanTest)
+ defer removeConf(path2)
+
+ session := podmanTest.Podman([]string{"network", "ls", "--filter", "name=" + name1, "--filter", "name=" + name2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(name1))
+ Expect(session.OutputToString()).To(ContainSubstring(name2))
+ })
+
+ It("podman network list --filter labels", func() {
+ net1 := "labelnet" + stringid.GenerateNonCryptoID()
+ label1 := "testlabel1=abc"
+ label2 := "abcdef"
+ session := podmanTest.Podman([]string{"network", "create", "--label", label1, net1})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net1)
+ Expect(session.ExitCode()).To(BeZero())
+
+ net2 := "labelnet" + stringid.GenerateNonCryptoID()
+ session = podmanTest.Podman([]string{"network", "create", "--label", label1, "--label", label2, net2})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net2)
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring(net1))
+ Expect(session.OutputToString()).To(ContainSubstring(net2))
+
+ session = podmanTest.Podman([]string{"network", "ls", "--filter", "label=" + label1, "--filter", "label=" + label2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).ToNot(ContainSubstring(net1))
+ Expect(session.OutputToString()).To(ContainSubstring(net2))
+ })
+
+ It("podman network list --filter invalid value", func() {
+ session := podmanTest.Podman([]string{"network", "ls", "--filter", "namr=ab"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
+ Expect(session.ErrorToString()).To(ContainSubstring(`invalid filter "namr"`))
+ })
+
It("podman network list --filter failure", func() {
name, path := generateNetworkConfig(podmanTest)
defer removeConf(path)
@@ -76,6 +135,40 @@ var _ = Describe("Podman network", func() {
Expect(session.LineInOutputContains(name)).To(BeFalse())
})
+ It("podman network ID test", func() {
+ net := "networkIDTest"
+ // the network id should be the sha256 hash of the network name
+ netID := "6073aefe03cdf8f29be5b23ea9795c431868a3a22066a6290b187691614fee84"
+ session := podmanTest.Podman([]string{"network", "create", net})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net)
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID[:12]))
+
+ session = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}} {{.ID}}", "--filter", "id=" + netID[10:50], "--no-trunc"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(ContainSubstring(net + " " + netID))
+
+ session = podmanTest.Podman([]string{"network", "inspect", netID[:40]})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(ContainSubstring(net))
+
+ session = podmanTest.Podman([]string{"network", "inspect", netID[1:]})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).ToNot(BeZero())
+ Expect(session.ErrorToString()).To(ContainSubstring("no such network"))
+
+ session = podmanTest.Podman([]string{"network", "rm", netID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ })
+
rm_func := func(rm string) {
It(fmt.Sprintf("podman network %s no args", rm), func() {
session := podmanTest.Podman([]string{"network", rm})
@@ -347,159 +440,6 @@ var _ = Describe("Podman network", func() {
Expect(c3.ExitCode()).To(BeZero())
})
- It("bad network name in disconnect should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- dis := podmanTest.Podman([]string{"network", "disconnect", "foobar", "test"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
-
- })
-
- It("bad container name in network disconnect should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- dis := podmanTest.Podman([]string{"network", "disconnect", netName, "foobar"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
-
- })
-
- It("podman network disconnect with invalid container state should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
- ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
-
- dis := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
- })
-
- It("podman network disconnect", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
- ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
-
- exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
- exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
-
- dis := podmanTest.Podman([]string{"network", "disconnect", netName, "test"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).To(BeZero())
-
- exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
- exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).ToNot(BeZero())
- })
-
- It("bad network name in connect should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- dis := podmanTest.Podman([]string{"network", "connect", "foobar", "test"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
-
- })
-
- It("bad container name in network connect should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- dis := podmanTest.Podman([]string{"network", "connect", netName, "foobar"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
-
- })
-
- It("podman connect on a container that already is connected to the network should error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
- ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
-
- con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
- con.WaitWithDefaultTimeout()
- Expect(con.ExitCode()).ToNot(BeZero())
- })
-
- It("podman network connect with invalid container state should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
- ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
-
- dis := podmanTest.Podman([]string{"network", "connect", netName, "test"})
- dis.WaitWithDefaultTimeout()
- Expect(dis.ExitCode()).ToNot(BeZero())
- })
-
- It("podman network connect", func() {
- SkipIfRemote("This requires a pending PR to be merged before it will work")
- SkipIfRootless("network connect and disconnect are only rootfull")
- netName := "aliasTest" + stringid.GenerateNonCryptoID()
- session := podmanTest.Podman([]string{"network", "create", netName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(netName)
-
- ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
- ctr.WaitWithDefaultTimeout()
- Expect(ctr.ExitCode()).To(BeZero())
-
- exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
- exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
-
- // Create a second network
- newNetName := "aliasTest" + stringid.GenerateNonCryptoID()
- session = podmanTest.Podman([]string{"network", "create", newNetName})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(BeZero())
- defer podmanTest.removeCNINetwork(newNetName)
-
- connect := podmanTest.Podman([]string{"network", "connect", newNetName, "test"})
- connect.WaitWithDefaultTimeout()
- Expect(connect.ExitCode()).To(BeZero())
-
- exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
- exec.WaitWithDefaultTimeout()
- Expect(exec.ExitCode()).To(BeZero())
- })
-
It("podman network create/remove macvlan", func() {
net := "macvlan" + stringid.GenerateNonCryptoID()
nc := podmanTest.Podman([]string{"network", "create", "--macvlan", "lo", net})
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index a3ce8bd69..4aaf2cbc1 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -61,7 +61,7 @@ var _ = Describe("Podman port", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
- Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
+ Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
})
It("podman container port -l nginx", func() {
@@ -79,7 +79,7 @@ var _ = Describe("Podman port", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
- Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
+ Expect(result.LineInOutputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
})
It("podman port -l port nginx", func() {
@@ -97,7 +97,7 @@ var _ = Describe("Podman port", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
port := strings.Split(result.OutputToStringArray()[0], ":")[1]
- Expect(result.LineInOuputStartsWith(fmt.Sprintf("0.0.0.0:%s", port))).To(BeTrue())
+ Expect(result.LineInOutputStartsWith(fmt.Sprintf("0.0.0.0:%s", port))).To(BeTrue())
})
It("podman port -a nginx", func() {
@@ -124,7 +124,7 @@ var _ = Describe("Podman port", func() {
result := podmanTest.Podman([]string{"port", "portcheck"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- result.LineInOuputStartsWith("80/tcp -> 0.0.0.0:")
+ result.LineInOutputStartsWith("80/tcp -> 0.0.0.0:")
})
It("podman port multiple ports", func() {
@@ -142,12 +142,12 @@ var _ = Describe("Podman port", func() {
result1 := podmanTest.Podman([]string{"port", "test", "5000"})
result1.WaitWithDefaultTimeout()
Expect(result1.ExitCode()).To(BeZero())
- Expect(result1.LineInOuputStartsWith("0.0.0.0:5000")).To(BeTrue())
+ Expect(result1.LineInOutputStartsWith("0.0.0.0:5000")).To(BeTrue())
// Check that the second port was honored
result2 := podmanTest.Podman([]string{"port", "test", "5001"})
result2.WaitWithDefaultTimeout()
Expect(result2.ExitCode()).To(BeZero())
- Expect(result2.LineInOuputStartsWith("0.0.0.0:5001")).To(BeTrue())
+ Expect(result2.LineInOutputStartsWith("0.0.0.0:5001")).To(BeTrue())
})
})
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index f1b055d6d..446e2bd38 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "runtime"
"strings"
. "github.com/containers/podman/v2/test/utils"
@@ -384,7 +385,7 @@ var _ = Describe("Podman pull", func() {
session := podmanTest.Podman([]string{"pull", "--all-tags", "k8s.gcr.io/pause"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("Pulled Images:")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("Pulled Images:")).To(BeTrue())
session = podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
@@ -494,4 +495,31 @@ var _ = Describe("Podman pull", func() {
Expect(data[0].ID).To(Equal(image1))
}
})
+
+ It("podman pull --platform", func() {
+ session := podmanTest.Podman([]string{"pull", "--platform=linux/bogus", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ expectedError := "no image found in manifest list for architecture bogus"
+ Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
+
+ session = podmanTest.Podman([]string{"pull", "--platform=linux/arm64", "--override-os", "windows", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ expectedError = "--platform option can not be specified with --overide-arch or --override-os"
+ Expect(session.ErrorToString()).To(ContainSubstring(expectedError))
+
+ session = podmanTest.Podman([]string{"pull", "-q", "--platform=linux/arm64", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ setup := podmanTest.Podman([]string{"image", "inspect", session.OutputToString()})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ data := setup.InspectImageJSON() // returns []inspect.ImageData
+ Expect(len(data)).To(Equal(1))
+ Expect(data[0].Os).To(Equal(runtime.GOOS))
+ Expect(data[0].Architecture).To(Equal("arm64"))
+ })
})
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index ff018f5d8..c8996c5e8 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -36,14 +36,14 @@ var _ = Describe("Podman run dns", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=foobar.com", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("search foobar.com")
+ session.LineInOutputStartsWith("search foobar.com")
})
It("podman run remove all search domain", func() {
session := podmanTest.Podman([]string{"run", "--dns-search=.", ALPINE, "cat", "/etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("search")).To(BeFalse())
+ Expect(session.LineInOutputStartsWith("search")).To(BeFalse())
})
It("podman run add bad dns server", func() {
@@ -56,14 +56,14 @@ 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.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("server 1.2.3.4")
+ session.LineInOutputStartsWith("server 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.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("options debug")
+ session.LineInOutputStartsWith("options debug")
})
It("podman run add bad host", func() {
@@ -76,8 +76,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.ExitCode()).To(Equal(0))
- session.LineInOuputStartsWith("1.1.1.1 foobar")
- session.LineInOuputStartsWith("2001:db8::68 foobaz")
+ session.LineInOutputStartsWith("1.1.1.1 foobar")
+ session.LineInOutputStartsWith("2001:db8::68 foobaz")
})
It("podman run add hostname", func() {
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index 2185d6b13..cac3d759d 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -99,12 +99,12 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("Linux")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("Linux")).To(BeTrue())
session = podmanTest.Podman([]string{"run", "--entrypoint", "", "foobar.com/entrypoint:latest", "uname"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("Linux")).To(BeTrue())
+ Expect(session.LineInOutputStartsWith("Linux")).To(BeTrue())
})
It("podman run user entrypoint with command overrides image entrypoint and image cmd", func() {
@@ -116,6 +116,6 @@ ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]
session := podmanTest.Podman([]string{"run", "--entrypoint=uname", "foobar.com/entrypoint:latest", "-r"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.LineInOuputStartsWith("Linux")).To(BeFalse())
+ Expect(session.LineInOutputStartsWith("Linux")).To(BeFalse())
})
})