summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/10-images.at2
-rw-r--r--test/e2e/container_clone_test.go17
-rw-r--r--test/e2e/create_test.go2
-rw-r--r--test/e2e/generate_kube_test.go2
-rw-r--r--test/e2e/generate_spec_test.go2
-rw-r--r--test/e2e/healthcheck_run_test.go6
-rw-r--r--test/e2e/secret_test.go34
-rw-r--r--test/system/030-run.bats7
-rw-r--r--test/system/700-play.bats25
9 files changed, 93 insertions, 4 deletions
diff --git a/test/apiv2/10-images.at b/test/apiv2/10-images.at
index f03b95786..4fd954e37 100644
--- a/test/apiv2/10-images.at
+++ b/test/apiv2/10-images.at
@@ -203,7 +203,7 @@ t POST "build?dockerfile=containerfile" $CONTAINERFILE_TAR application/json 200
# Libpod: allow building from url: https://github.com/alpinelinux/docker-alpine.git and must ignore any provided tar
t POST "libpod/build?remote=https%3A%2F%2Fgithub.com%2Falpinelinux%2Fdocker-alpine.git" $CONTAINERFILE_TAR 200 \
- .stream~"STEP 1/5: FROM alpine:3.14"
+ .stream~"STEP 1/5: FROM alpine:"
# Build api response header must contain Content-type: application/json
t POST "build?dockerfile=containerfile" $CONTAINERFILE_TAR application/json 200
diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go
index 94ccd6ffe..1ba5de1a3 100644
--- a/test/e2e/container_clone_test.go
+++ b/test/e2e/container_clone_test.go
@@ -87,6 +87,7 @@ var _ = Describe("Podman container clone", func() {
})
It("podman container clone resource limits override", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
create := podmanTest.Podman([]string{"create", "--cpus=5", ALPINE})
create.WaitWithDefaultTimeout()
Expect(create).To(Exit(0))
@@ -292,4 +293,20 @@ var _ = Describe("Podman container clone", func() {
Expect(ok).To(BeTrue())
})
+
+ It("podman container clone env test", func() {
+ session := podmanTest.Podman([]string{"run", "--name", "env_ctr", "-e", "ENV_TEST=123", ALPINE, "printenv", "ENV_TEST"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"container", "clone", "env_ctr"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"start", "-a", "env_ctr-clone"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(ContainSubstring("123"))
+
+ })
})
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 9679aad24..b35d0f3c5 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -438,6 +438,7 @@ var _ = Describe("Podman create", func() {
})
It("podman create with -m 1000000 sets swap to 2000000", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
numMem := 1000000
ctrName := "testCtr"
session := podmanTest.Podman([]string{"create", "-t", "-m", fmt.Sprintf("%db", numMem), "--name", ctrName, ALPINE, "/bin/sh"})
@@ -452,6 +453,7 @@ var _ = Describe("Podman create", func() {
})
It("podman create --cpus 5 sets nanocpus", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
numCpus := 5
nanoCPUs := numCpus * 1000000000
ctrName := "testCtr"
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 142f32d19..e7ceaf2d2 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -490,6 +490,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate kube on pod with memory limit", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
podName := "testMemoryLimit"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
podSession.WaitWithDefaultTimeout()
@@ -515,6 +516,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate kube on pod with cpu limit", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
podName := "testCpuLimit"
podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName})
podSession.WaitWithDefaultTimeout()
diff --git a/test/e2e/generate_spec_test.go b/test/e2e/generate_spec_test.go
index 57cd9546b..9188b5222 100644
--- a/test/e2e/generate_spec_test.go
+++ b/test/e2e/generate_spec_test.go
@@ -41,6 +41,7 @@ var _ = Describe("Podman generate spec", func() {
})
It("podman generate spec basic usage", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -51,6 +52,7 @@ var _ = Describe("Podman generate spec", func() {
})
It("podman generate spec file", func() {
+ SkipIfRootlessCgroupsV1("Not supported for rootless + CgroupsV1")
session := podmanTest.Podman([]string{"create", "--cpus", "5", "--name", "specgen", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index fd4e763f9..969f83b19 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -317,6 +317,12 @@ HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ // Check if image inspect contains CMD-SHELL generated by healthcheck.
+ session = podmanTest.Podman([]string{"image", "inspect", "--format", "{{.Config.Healthcheck}}", "test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring("CMD-SHELL"))
+
run := podmanTest.Podman([]string{"run", "-dt", "--name", "hctest", "test", "ls"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index ed328d84a..c6d5e6391 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -40,7 +40,7 @@ var _ = Describe("Podman secret", func() {
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
Expect(err).To(BeNil())
- session := podmanTest.Podman([]string{"secret", "create", "--driver-opts", "opt1=val", "a", secretFilePath})
+ session := podmanTest.Podman([]string{"secret", "create", "-d", "file", "--driver-opts", "opt1=val", "a", secretFilePath})
session.WaitWithDefaultTimeout()
secrID := session.OutputToString()
Expect(session).Should(Exit(0))
@@ -49,7 +49,7 @@ var _ = Describe("Podman secret", func() {
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal(secrID))
- inspect = podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.Spec.Driver.Options}}", secrID})
+ inspect = podmanTest.Podman([]string{"secret", "inspect", "-f", "{{.Spec.Driver.Options}}", secrID})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(ContainSubstring("opt1:val"))
@@ -145,6 +145,36 @@ var _ = Describe("Podman secret", func() {
})
+ It("podman secret ls --quiet", func() {
+ secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
+ err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
+ Expect(err).To(BeNil())
+
+ secretName := "a"
+
+ session := podmanTest.Podman([]string{"secret", "create", secretName, secretFilePath})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ secretID := session.OutputToString()
+
+ list := podmanTest.Podman([]string{"secret", "ls", "-q"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretID))
+
+ list = podmanTest.Podman([]string{"secret", "ls", "--quiet"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretID))
+
+ // Prefer format over quiet
+ list = podmanTest.Podman([]string{"secret", "ls", "-q", "--format", "{{.Name}}"})
+ list.WaitWithDefaultTimeout()
+ Expect(list).Should(Exit(0))
+ Expect(list.OutputToString()).To(Equal(secretName))
+
+ })
+
It("podman secret ls with filters", func() {
secretFilePath := filepath.Join(podmanTest.TempDir, "secret")
err := ioutil.WriteFile(secretFilePath, []byte("mysecret"), 0755)
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index 908c169ee..a3bfe5780 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -56,7 +56,12 @@ echo $rand | 0 | $rand
@test "podman run --memory=0 runtime option" {
run_podman run --memory=0 --rm $IMAGE echo hello
- is "$output" "hello" "failed to run when --memory is set to 0"
+ if is_rootless && ! is_cgroupsv2; then
+ is "${lines[0]}" "Resource limits are not supported and ignored on cgroups V1 rootless systems" "--memory is not supported"
+ is "${lines[1]}" "hello" "--memory is ignored"
+ else
+ is "$output" "hello" "failed to run when --memory is set to 0"
+ fi
}
# 'run --preserve-fds' passes a number of additional file descriptors into the container
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index e1955cfd1..bad9544ff 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -361,3 +361,28 @@ status: {}
run_podman pod rm -a
run_podman rm -a
}
+
+@test "podman kube play - URL" {
+ TESTDIR=$PODMAN_TMPDIR/testdir
+ mkdir -p $TESTDIR
+ echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+
+ HOST_PORT=$(random_free_port)
+ SERVER=http://127.0.0.1:$HOST_PORT
+
+ run_podman run -d --name myyaml -p "$HOST_PORT:80" \
+ -v $PODMAN_TMPDIR/test.yaml:/var/www/testpod.yaml:Z \
+ -w /var/www \
+ $IMAGE /bin/busybox-extras httpd -f -p 80
+
+ run_podman kube play $SERVER/testpod.yaml
+ run_podman inspect test_pod-test --format "{{.State.Running}}"
+ is "$output" "true"
+ run_podman kube down $SERVER/testpod.yaml
+ run_podman 125 inspect test_pod-test
+ is "$output" ".*Error: inspecting object: no such object: \"test_pod-test\""
+
+ run_podman pod rm -a -f
+ run_podman rm -a -f
+ run_podman rm -f -t0 myyaml
+}