summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/play_kube_test.go81
-rw-r--r--test/e2e/save_test.go22
-rw-r--r--test/system/070-build.bats12
3 files changed, 111 insertions, 4 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index e479b88cc..f89da4c05 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/podman/v3/pkg/util"
. "github.com/containers/podman/v3/test/utils"
+ "github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opencontainers/selinux/go-selinux"
@@ -1716,6 +1717,38 @@ spec:
}
})
+ It("podman play kube --ip", func() {
+ var i, numReplicas int32
+ numReplicas = 3
+ deployment := getDeployment(withReplicas(numReplicas))
+ err := generateKubeYaml("deployment", deployment, kubeYaml)
+ Expect(err).To(BeNil())
+
+ net := "playkube" + stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", "--subnet", "10.25.31.0/24", net})
+ session.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net)
+ Expect(session.ExitCode()).To(BeZero())
+
+ ips := []string{"10.25.31.5", "10.25.31.10", "10.25.31.15"}
+ playArgs := []string{"play", "kube", "--network", net}
+ for _, ip := range ips {
+ playArgs = append(playArgs, "--ip", ip)
+ }
+
+ kube := podmanTest.Podman(append(playArgs, kubeYaml))
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ podNames := getPodNamesInDeployment(deployment)
+ for i = 0; i < numReplicas; i++ {
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&podNames[i]), "--format", "{{ .NetworkSettings.Networks." + net + ".IPAddress }}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(Equal(ips[i]))
+ }
+ })
+
It("podman play kube test with network portbindings", func() {
ip := "127.0.0.100"
port := "5000"
@@ -1861,6 +1894,54 @@ spec:
Expect(inspect.OutputToString()).To(ContainSubstring(correct))
})
+ It("podman play kube test duplicate volume destination between host path and image volumes", func() {
+ // Create host test directory and file
+ testdir := "testdir"
+ testfile := "testfile"
+
+ hostPathDir := filepath.Join(tempdir, testdir)
+ err := os.Mkdir(hostPathDir, 0755)
+ Expect(err).To(BeNil())
+
+ hostPathDirFile := filepath.Join(hostPathDir, testfile)
+ f, err := os.Create(hostPathDirFile)
+ Expect(err).To(BeNil())
+ f.Close()
+
+ // Create container image with named volume
+ containerfile := fmt.Sprintf(`
+FROM %s
+VOLUME %s`, ALPINE, hostPathDir+"/")
+
+ image := "podman-kube-test:podman"
+ podmanTest.BuildImage(containerfile, image, "false")
+
+ // Create and play kube pod
+ ctr := getCtr(withVolumeMount(hostPathDir+"/", false), withImage(image))
+ pod := getPod(withCtr(ctr), withVolume(getHostPathVolume("Directory", hostPathDir+"/")))
+ err = generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ls", hostPathDir + "/" + testfile})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+
+ // If two volumes are specified and share the same destination,
+ // only one will be mounted. Host path volumes take precedence.
+ ctrJSON := inspect.InspectContainerToJSON()
+ Expect(len(ctrJSON[0].Mounts)).To(Equal(1))
+ Expect(ctrJSON[0].Mounts[0].Type).To(Equal("bind"))
+
+ })
+
It("podman play kube test with PersistentVolumeClaim volume", func() {
volumeName := "namedVolume"
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index 5ddd5efc8..69184649f 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -79,7 +79,7 @@ var _ = Describe("Podman save", func() {
})
It("podman save to directory with oci format", func() {
- if rootless.IsRootless() && podmanTest.RemoteTest {
+ if rootless.IsRootless() {
Skip("Requires a fix in containers image for chown/lchown")
}
outdir := filepath.Join(podmanTest.TempDir, "save")
@@ -90,7 +90,7 @@ var _ = Describe("Podman save", func() {
})
It("podman save to directory with v2s2 docker format", func() {
- if rootless.IsRootless() && podmanTest.RemoteTest {
+ if rootless.IsRootless() {
Skip("Requires a fix in containers image for chown/lchown")
}
outdir := filepath.Join(podmanTest.TempDir, "save")
@@ -111,6 +111,24 @@ var _ = Describe("Podman save", func() {
Expect(save.ExitCode()).To(Equal(0))
})
+ It("podman save to directory with --compress but not use docker-dir and oci-dir", func() {
+ if rootless.IsRootless() && podmanTest.RemoteTest {
+ Skip("Requires a fix in containers image for chown/lchown")
+ }
+ outdir := filepath.Join(podmanTest.TempDir, "save")
+
+ save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-archive", "-o", outdir, ALPINE})
+ save.WaitWithDefaultTimeout()
+ // should not be 0
+ Expect(save.ExitCode()).ToNot(Equal(0))
+
+ save = podmanTest.Podman([]string{"save", "--compress", "--format", "oci-archive", "-o", outdir, ALPINE})
+ save.WaitWithDefaultTimeout()
+ // should not be 0
+ Expect(save.ExitCode()).ToNot(Equal(0))
+
+ })
+
It("podman save bad filename", func() {
outdir := filepath.Join(podmanTest.TempDir, "save:colon")
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 5a887c71e..d4017ae01 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -691,8 +691,16 @@ RUN echo $random_string
EOF
run_podman 125 build -t build_test --pull-never $tmpdir
- is "$output" ".* pull policy is .never. but .* could not be found locally" \
- "--pull-never fails with expected error message"
+ # FIXME: this is just ridiculous. Even after #10030 and #10034, Ubuntu
+ # remote *STILL* flakes this test! It fails with the correct exit status,
+ # but the error output is 'Error: stream dropped, unexpected failure'
+ # Let's just stop checking on podman-remote. As long as it exits 125,
+ # we're happy.
+ if ! is_remote; then
+ is "$output" \
+ ".* pull policy is .never. but .* could not be found locally" \
+ "--pull-never fails with expected error message"
+ fi
}
@test "podman build --logfile test" {