summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/create_test.go32
-rw-r--r--test/e2e/network_test.go59
-rw-r--r--test/e2e/pull_test.go28
3 files changed, 119 insertions, 0 deletions
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/network_test.go b/test/e2e/network_test.go
index 20e1d5b6b..ad6af61c7 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)
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index f1b055d6d..c572fc5ac 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"
@@ -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"))
+ })
})