aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/README.md2
-rwxr-xr-xtest/buildah-bud/apply-podman-deltas9
-rw-r--r--test/e2e/checkpoint_test.go12
-rw-r--r--test/e2e/cleanup_test.go128
-rw-r--r--test/e2e/image_scp_test.go5
-rw-r--r--test/e2e/init_test.go10
-rw-r--r--test/e2e/rmi_test.go78
-rw-r--r--test/e2e/run_cleanup_test.go45
-rw-r--r--test/e2e/run_userns_test.go24
-rw-r--r--test/e2e/start_test.go59
-rw-r--r--test/e2e/stop_test.go17
-rw-r--r--test/system/010-images.bats6
-rw-r--r--test/system/045-start.bats16
-rw-r--r--test/system/050-stop.bats16
-rw-r--r--test/system/520-checkpoint.bats19
-rw-r--r--test/system/900-ssh.bats61
-rw-r--r--test/system/TODO.md2
-rw-r--r--test/system/helpers.bash15
18 files changed, 497 insertions, 27 deletions
diff --git a/test/README.md b/test/README.md
index 769bdbfd7..b44deadaf 100644
--- a/test/README.md
+++ b/test/README.md
@@ -1,4 +1,4 @@
-![PODMAN logo](../logo/podman-logo-source.svg)
+![PODMAN logo](https://raw.githubusercontent.com/containers/common/main/logos/podman-logo-full-vert.png)
# Test utils
Test utils provide common functions and structs for testing. It includes two structs:
* `PodmanTest`: Handle the *podman* command and other global resources like temporary
diff --git a/test/buildah-bud/apply-podman-deltas b/test/buildah-bud/apply-podman-deltas
index 6578afc93..8ce58b06d 100755
--- a/test/buildah-bud/apply-podman-deltas
+++ b/test/buildah-bud/apply-podman-deltas
@@ -152,6 +152,10 @@ errmsg "checking authfile: stat /tmp/nonexistent: no such file or directory" \
"Error: checking authfile: stat /tmp/nonexistent: no such file or directory" \
"bud with Containerfile should fail with nonexistent authfile"
+errmsg "cannot find Containerfile or Dockerfile" \
+ "no such file or directory" \
+ "bud-github-context-from-commit"
+
###############################################################################
# BEGIN tests that don't make sense under podman due to fundamental differences
@@ -216,7 +220,10 @@ skip_if_remote "--output option not implemented in podman-remote" \
"build with custom build output and output rootfs to tar" \
"build with custom build output and output rootfs to tar by pipe" \
"build with custom build output must fail for bad input" \
- "build with custom build output and output rootfs to tar with no additional step"
+ "build with custom build output and output rootfs to tar with no additional step" \
+ "build with custom build output for single-stage-cached and output rootfs to directory" \
+ "build with custom build output for multi-stage-cached and output rootfs to directory" \
+ "build with custom build output for multi-stage and output rootfs to directory"
# https://github.com/containers/podman/issues/14544
skip_if_remote "logfile not implemented on remote" "bud-logfile-with-split-logfile-by-platform"
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 8f5e1a0b6..bc99455f3 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -132,6 +132,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal(cid))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -156,6 +157,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal(cid))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -214,6 +216,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal("test_name"))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
@@ -221,6 +224,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal("test_name"))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
@@ -298,6 +302,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal("second"))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
ps := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
@@ -310,6 +315,7 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(Equal("second"))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
Expect(podmanTest.GetContainerStatus()).To(Not(ContainSubstring("Exited")))
@@ -325,16 +331,20 @@ var _ = Describe("Podman checkpoint", func() {
session1 := podmanTest.Podman(localRunString)
session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0))
+ cid1 := session1.OutputToString()
localRunString = getRunString([]string{"--name", "second", ALPINE, "top"})
session2 := podmanTest.Podman(localRunString)
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
+ cid2 := session2.OutputToString()
result := podmanTest.Podman([]string{"container", "checkpoint", "-a"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(ContainSubstring(cid1))
+ Expect(result.OutputToString()).To(ContainSubstring(cid2))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
ps := podmanTest.Podman([]string{"ps", "-q", "--no-trunc"})
@@ -347,6 +357,8 @@ var _ = Describe("Podman checkpoint", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(ContainSubstring(cid1))
+ Expect(result.OutputToString()).To(ContainSubstring(cid2))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
Expect(podmanTest.GetContainerStatus()).To(Not(ContainSubstring("Exited")))
diff --git a/test/e2e/cleanup_test.go b/test/e2e/cleanup_test.go
new file mode 100644
index 000000000..f15f9bd5a
--- /dev/null
+++ b/test/e2e/cleanup_test.go
@@ -0,0 +1,128 @@
+package integration
+
+import (
+ "os"
+
+ . "github.com/containers/podman/v4/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
+)
+
+var _ = Describe("Podman container cleanup", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ SkipIfRemote("podman container cleanup is not supported in remote")
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+
+ })
+
+ It("podman cleanup bogus container", func() {
+ session := podmanTest.Podman([]string{"container", "cleanup", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("no such container"))
+ })
+
+ It("podman cleanup container by id", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+ session = podmanTest.Podman([]string{"container", "cleanup", cid})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(cid))
+ })
+
+ It("podman cleanup container by short id", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+ shortID := cid[0:10]
+ session = podmanTest.Podman([]string{"container", "cleanup", shortID})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(shortID))
+ })
+
+ It("podman cleanup container by name", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "foo", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"container", "cleanup", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal("foo"))
+ })
+
+ It("podman cleanup all containers", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"container", "cleanup", "--all"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(cid))
+ })
+
+ It("podman cleanup latest container", func() {
+ SkipIfRemote("--latest flag n/a")
+ session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"container", "cleanup", "--latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(cid))
+ })
+
+ It("podman cleanup running container", func() {
+ session := podmanTest.RunTopContainer("running")
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"container", "cleanup", "running"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("container state improper"))
+ })
+
+ It("podman cleanup paused container", func() {
+ SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1")
+ session := podmanTest.RunTopContainer("paused")
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"pause", "paused"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"container", "cleanup", "paused"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("container state improper"))
+ })
+})
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 77fe810bd..2c275d974 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -3,9 +3,11 @@ package integration
import (
"io/ioutil"
"os"
+ "path/filepath"
"github.com/containers/common/pkg/config"
. "github.com/containers/podman/v4/test/utils"
+ "github.com/containers/storage/pkg/homedir"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -56,6 +58,9 @@ var _ = Describe("podman image scp", func() {
})
It("podman image scp with proper connection", func() {
+ if _, err := os.Stat(filepath.Join(homedir.Get(), ".ssh", "known_hosts")); err != nil {
+ Skip("known_hosts does not exist or is not accessible")
+ }
cmd := []string{"system", "connection", "add",
"--default",
"QA",
diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go
index ccc102fa3..25b9e079a 100644
--- a/test/e2e/init_test.go
+++ b/test/e2e/init_test.go
@@ -52,6 +52,7 @@ var _ = Describe("Podman init", func() {
init := podmanTest.Podman([]string{"init", cid})
init.WaitWithDefaultTimeout()
Expect(init).Should(Exit(0))
+ Expect(init.OutputToString()).To(Equal(cid))
result := podmanTest.Podman([]string{"inspect", cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
@@ -67,6 +68,7 @@ var _ = Describe("Podman init", func() {
init := podmanTest.Podman([]string{"init", name})
init.WaitWithDefaultTimeout()
Expect(init).Should(Exit(0))
+ Expect(init.OutputToString()).To(Equal(name))
result := podmanTest.Podman([]string{"inspect", name})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
@@ -79,9 +81,11 @@ var _ = Describe("Podman init", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
init := podmanTest.Podman([]string{"init", "--latest"})
init.WaitWithDefaultTimeout()
Expect(init).Should(Exit(0))
+ Expect(init.OutputToString()).To(Equal(cid))
result := podmanTest.Podman([]string{"inspect", "--latest"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
@@ -93,15 +97,21 @@ var _ = Describe("Podman init", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
session2 := podmanTest.Podman([]string{"create", "--name", "test2", ALPINE, "ls"})
session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0))
+ cid2 := session2.OutputToString()
session3 := podmanTest.Podman([]string{"run", "--name", "test3", "-d", ALPINE, "top"})
session3.WaitWithDefaultTimeout()
Expect(session3).Should(Exit(0))
+ cid3 := session3.OutputToString()
init := podmanTest.Podman([]string{"init", "--all"})
init.WaitWithDefaultTimeout()
Expect(init).Should(Exit(0))
+ Expect(init.OutputToString()).To(ContainSubstring(cid))
+ Expect(init.OutputToString()).To(ContainSubstring(cid2))
+ Expect(init.OutputToString()).To(ContainSubstring(cid3))
result := podmanTest.Podman([]string{"inspect", "test1"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index d1a0cd6f5..f87f65c34 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -307,4 +307,82 @@ RUN touch %s`, CIRROS_IMAGE, imageName)
}
wg.Wait()
})
+
+ It("podman rmi --no-prune with dangling parents", func() {
+ podmanTest.AddImageToRWStore(ALPINE)
+ session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ imageID2 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"create", "--name", "c_test3", "test2", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test3", "test3"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ imageID3 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"untag", "test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"untag", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"rmi", "-f", "--no-prune", "test3"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring(imageID3))
+ Expect(session.OutputToString()).NotTo(ContainSubstring(imageID2))
+ })
+
+ It("podman rmi --no-prune with undangling parents", func() {
+ podmanTest.AddImageToRWStore(ALPINE)
+ session := podmanTest.Podman([]string{"create", "--name", "c_test1", ALPINE, "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test1", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"create", "--name", "c_test2", "test1", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test2", "test2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ imageID2 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"create", "--name", "c_test3", "test2", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"commit", "-q", "c_test3", "test3"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ imageID3 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"rmi", "-f", "--no-prune", "test3"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring(imageID3))
+ Expect(session.OutputToString()).NotTo(ContainSubstring(imageID2))
+ })
})
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index ea2caf907..5aa81140d 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -36,7 +36,7 @@ var _ = Describe("Podman run exit", func() {
It("podman run -d mount cleanup test", func() {
SkipIfRemote("podman-remote does not support mount")
- SkipIfRootless("TODO rootless podman mount requires podman unshare first")
+ SkipIfRootless("rootless podman mount requires podman unshare first")
result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
result.WaitWithDefaultTimeout()
@@ -69,6 +69,49 @@ var _ = Describe("Podman run exit", func() {
pmount.WaitWithDefaultTimeout()
Expect(pmount).Should(Exit(0))
Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
+ })
+
+ It("podman run -d mount cleanup rootless test", func() {
+ SkipIfRemote("podman-remote does not support mount")
+ SkipIfNotRootless("Use unshare in rootless only")
+
+ result := podmanTest.Podman([]string{"run", "-dt", ALPINE, "top"})
+ result.WaitWithDefaultTimeout()
+ cid := result.OutputToString()
+ Expect(result).Should(Exit(0))
+
+ mount := podmanTest.Podman([]string{"unshare", "mount"})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount).Should(Exit(0))
+ Expect(mount.OutputToString()).To(ContainSubstring(cid))
+
+ // command: podman <options> unshare podman <options> image mount ALPINE
+ args := []string{"unshare", podmanTest.PodmanBinary}
+ opts := podmanTest.PodmanMakeOptions([]string{"mount", "--no-trunc"}, false, false)
+ args = append(args, opts...)
+
+ pmount := podmanTest.Podman(args)
+ pmount.WaitWithDefaultTimeout()
+ Expect(pmount).Should(Exit(0))
+ Expect(pmount.OutputToString()).To(ContainSubstring(cid))
+ stop := podmanTest.Podman([]string{"stop", cid})
+ stop.WaitWithDefaultTimeout()
+ Expect(stop).Should(Exit(0))
+
+ // We have to force cleanup so the unmount happens
+ podmanCleanupSession := podmanTest.Podman([]string{"container", "cleanup", cid})
+ podmanCleanupSession.WaitWithDefaultTimeout()
+ Expect(podmanCleanupSession).Should(Exit(0))
+
+ mount = podmanTest.Podman([]string{"unshare", "mount"})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount).Should(Exit(0))
+ Expect(mount.OutputToString()).NotTo(ContainSubstring(cid))
+
+ pmount = podmanTest.Podman(args)
+ pmount.WaitWithDefaultTimeout()
+ Expect(pmount).Should(Exit(0))
+ Expect(pmount.OutputToString()).NotTo(ContainSubstring(cid))
})
})
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 613727118..f247b2dac 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -307,6 +307,30 @@ var _ = Describe("Podman UserNS support", func() {
}
})
+
+ It("podman --userns= conflicts with ui[dg]map and sub[ug]idname", func() {
+ session := podmanTest.Podman([]string{"run", "--userns=host", "--uidmap=0:1:500", "alpine", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("--userns and --uidmap/--gidmap/--subuidname/--subgidname are mutually exclusive"))
+
+ session = podmanTest.Podman([]string{"run", "--userns=host", "--gidmap=0:200:5000", "alpine", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(125))
+ Expect(session.ErrorToString()).To(ContainSubstring("--userns and --uidmap/--gidmap/--subuidname/--subgidname are mutually exclusive"))
+
+ // with sub[ug]idname we don't check for the error output since the error message could be different, depending on the
+ // system configuration since the specified user could not be defined and cause a different earlier error.
+ // In any case, make sure the command doesn't succeed.
+ session = podmanTest.Podman([]string{"run", "--userns=private", "--subuidname=containers", "alpine", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Not(Exit(0)))
+
+ session = podmanTest.Podman([]string{"run", "--userns=private", "--subgidname=containers", "alpine", "true"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Not(Exit(0)))
+ })
+
It("podman PODMAN_USERNS", func() {
SkipIfNotRootless("keep-id only works in rootless mode")
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index 73af9d12c..f3e8cc015 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
"strconv"
@@ -99,23 +100,6 @@ var _ = Describe("Podman start", func() {
Expect(session.OutputToString()).To(Equal(shortID))
})
- It("podman container start single container by short id", func() {
- session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- cid := session.OutputToString()
- shortID := cid[0:10]
- session = podmanTest.Podman([]string{"container", "start", shortID})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(Equal(shortID))
-
- session = podmanTest.Podman([]string{"stop", shortID})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(Equal(shortID))
- })
-
It("podman start single container by name", func() {
name := "foobar99"
session := podmanTest.Podman([]string{"create", "--name", name, ALPINE, "ls"})
@@ -124,9 +108,6 @@ var _ = Describe("Podman start", func() {
session = podmanTest.Podman([]string{"start", name})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- if podmanTest.RemoteTest {
- Skip("Container-start name check doesn't work on remote client. It always returns the full ID.")
- }
Expect(session.OutputToString()).To(Equal(name))
})
@@ -231,4 +212,42 @@ var _ = Describe("Podman start", func() {
_, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
Expect(err).To(BeNil())
})
+
+ It("podman start container --filter", func() {
+ session1 := podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid1 := session1.OutputToString()
+
+ session1 = podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid2 := session1.OutputToString()
+
+ session1 = podmanTest.Podman([]string{"container", "create", ALPINE})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ cid3 := session1.OutputToString()
+ shortCid3 := cid3[0:5]
+
+ session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(HaveLen(0))
+
+ session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(HaveLen(0))
+
+ session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid3))
+
+ session1 = podmanTest.Podman([]string{"start", "-f", fmt.Sprintf("id=%s", cid2)})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+ Expect(session1.OutputToString()).To(BeEquivalentTo(cid2))
+ })
})
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 7a258466a..23abb6d92 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -69,6 +69,19 @@ var _ = Describe("Podman stop", func() {
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
+ It("podman stop single container by short id", func() {
+ session := podmanTest.RunTopContainer("test1")
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+ shortID := cid[0:10]
+
+ session = podmanTest.Podman([]string{"stop", shortID})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(shortID))
+ })
+
It("podman stop container by name", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
@@ -198,9 +211,13 @@ var _ = Describe("Podman stop", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ cid := session.OutputToString()
+
session = podmanTest.Podman([]string{"stop", "-l", "-t", "1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(cid))
+
finalCtrs := podmanTest.Podman([]string{"ps", "-q"})
finalCtrs.WaitWithDefaultTimeout()
Expect(finalCtrs).Should(Exit(0))
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index aa390f236..16ee681a3 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -259,8 +259,8 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
run_podman 2 rmi -a
is "$output" "Error: 2 errors occurred:
-.** image used by .*: image is in use by a container
-.** image used by .*: image is in use by a container"
+.** image used by .*: image is in use by a container: consider listing external containers and force-removing image
+.** image used by .*: image is in use by a container: consider listing external containers and force-removing image"
run_podman rmi -af
is "$output" "Untagged: $IMAGE
@@ -292,7 +292,7 @@ Deleted: $pauseID" "infra images gets removed as well"
pauseID=$output
run_podman 2 rmi $pauseImage
- is "$output" "Error: image used by .* image is in use by a container"
+ is "$output" "Error: image used by .* image is in use by a container: consider listing external containers and force-removing image"
run_podman rmi -f $pauseImage
is "$output" "Untagged: $pauseImage
diff --git a/test/system/045-start.bats b/test/system/045-start.bats
index ad8483bba..d19171ec3 100644
--- a/test/system/045-start.bats
+++ b/test/system/045-start.bats
@@ -66,4 +66,20 @@ load helpers
is "$output" "$cid_exited_0"
}
+@test "podman start print IDs or raw input" {
+ # start --all must print the IDs
+ run_podman create $IMAGE top
+ ctrID="$output"
+ run_podman start --all
+ is "$output" "$ctrID"
+
+ # start $input must print $input
+ cname=$(random_string)
+ run_podman create --name $cname $IMAGE top
+ run_podman start $cname
+ is "$output" $cname
+
+ run_podman rm -t 0 -f $ctrID $cname
+}
+
# vim: filetype=sh
diff --git a/test/system/050-stop.bats b/test/system/050-stop.bats
index 39002512b..a21a036c2 100644
--- a/test/system/050-stop.bats
+++ b/test/system/050-stop.bats
@@ -59,6 +59,22 @@ load helpers
is "${lines[3]}" "c4--Created.*" "ps -a, created container (unaffected)"
}
+@test "podman stop print IDs or raw input" {
+ # stop -a must print the IDs
+ run_podman run -d $IMAGE top
+ ctrID="$output"
+ run_podman stop --all
+ is "$output" "$ctrID"
+
+ # stop $input must print $input
+ cname=$(random_string)
+ run_podman run -d --name $cname $IMAGE top
+ run_podman stop $cname
+ is "$output" $cname
+
+ run_podman rm -t 0 -f $ctrID $cname
+}
+
# #9051 : podman stop --ignore was not working with podman-remote
@test "podman stop --ignore" {
name=thiscontainerdoesnotexist
diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats
index 7c8fc143a..73fa5d4c4 100644
--- a/test/system/520-checkpoint.bats
+++ b/test/system/520-checkpoint.bats
@@ -101,6 +101,25 @@ function teardown() {
run_podman rm -t 0 -f $cid
}
+@test "podman checkpoint/restore print IDs or raw input" {
+ # checkpoint/restore -a must print the IDs
+ run_podman run -d $IMAGE top
+ ctrID="$output"
+ run_podman container checkpoint -a
+ is "$output" "$ctrID"
+ run_podman container restore -a
+ is "$output" "$ctrID"
+
+ # checkpoint/restore $input must print $input
+ cname=$(random_string)
+ run_podman run -d --name $cname $IMAGE top
+ run_podman container checkpoint $cname
+ is "$output" $cname
+ run_podman container restore $cname
+ is "$output" $cname
+
+ run_podman rm -t 0 -f $ctrID $cname
+}
@test "podman checkpoint --export, with volumes" {
skip_if_remote "Test uses --root/--runroot, which are N/A over remote"
diff --git a/test/system/900-ssh.bats b/test/system/900-ssh.bats
new file mode 100644
index 000000000..0757f5838
--- /dev/null
+++ b/test/system/900-ssh.bats
@@ -0,0 +1,61 @@
+#!/usr/bin/env bats
+#
+# Simplest set of podman tests. If any of these fail, we have serious problems.
+#
+
+load helpers
+
+# Override standard setup! We don't yet trust podman-images or podman-rm
+function setup() {
+ if ! is_remote; then
+ skip "only applicable on podman-remote"
+ fi
+
+ basic_setup
+}
+
+function teardown() {
+ if ! is_remote; then
+ return
+ fi
+
+ # In case test function failed to clean up
+ if [[ -n $_SERVICE_PID ]]; then
+ run kill $_SERVICE_PID
+ fi
+
+ # see test/system/272-system-connection.bats for why this is needed
+ mount \
+ | grep $PODMAN_TMPDIR \
+ | awk '{print $3}' \
+ | xargs -l1 --no-run-if-empty umount
+
+ run_podman system connection rm --all
+
+ basic_teardown
+}
+
+function _run_podman_remote() {
+ PODMAN=${PODMAN%%--url*} run_podman "$@"
+}
+
+@test "podman --ssh test" {
+ skip_if_no_ssh "cannot run these tests without an ssh binary"
+ # Start server
+ _SERVICE_PORT=$(random_free_port 63000-64999)
+
+ ${PODMAN%%-remote*} --root ${PODMAN_TMPDIR}/root \
+ --runroot ${PODMAN_TMPDIR}/runroot \
+ system service -t 99 tcp:localhost:$_SERVICE_PORT &
+ _SERVICE_PID=$!
+ wait_for_port localhost $_SERVICE_PORT
+
+ notme=${PODMAN_ROOTLESS_USER}
+
+ uid=$(id -u $notme)
+
+ run_podman 125 --ssh=native system connection add testing ssh://$notme@localhost:22/run/user/$uid/podman/podman.sock
+ is "$output" "Error: exit status 255"
+
+ # need to figure out how to podman remote test with the new ssh
+}
diff --git a/test/system/TODO.md b/test/system/TODO.md
index e47292f26..55e7601d1 100644
--- a/test/system/TODO.md
+++ b/test/system/TODO.md
@@ -1,4 +1,4 @@
-![PODMAN logo](../../logo/podman-logo-source.svg)
+![PODMAN logo](https://raw.githubusercontent.com/containers/common/main/logos/podman-logo-full-vert.png)
# Overview
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 19bc6547c..b821175bb 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -347,6 +347,10 @@ function wait_for_port() {
# BEGIN miscellaneous tools
# Shortcuts for common needs:
+function no_ssh() {
+ [ "$(man ssh)" -ne 0 ]
+}
+
function is_ubuntu() {
grep -qiw ubuntu /etc/os-release
}
@@ -470,6 +474,17 @@ function _add_label_if_missing() {
}
######################
+# skip_if_no_ssh # ...with an optional message
+######################
+function skip_if_no_ssh() {
+ if no_ssh; then
+ local msg=$(_add_label_if_missing "$1" "ssh")
+ skip "${msg:-not applicable with no ssh binary}"
+ fi
+}
+
+
+######################
# skip_if_rootless # ...with an optional message
######################
function skip_if_rootless() {