summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-04 16:44:19 +0200
committerGitHub <noreply@github.com>2021-05-04 16:44:19 +0200
commitaf2418018b8a0d83734a7a329955f5a9938bdfbf (patch)
treea070d47ae807ddd62eb7b6bc125eac70e10cf663 /test
parentdea6189982b4d128aa1ae9ce379a1f94b4eb8a8f (diff)
parent0c116f40d38a5d86c61a86e8ece19a6a88bd7141 (diff)
downloadpodman-af2418018b8a0d83734a7a329955f5a9938bdfbf.tar.gz
podman-af2418018b8a0d83734a7a329955f5a9938bdfbf.tar.bz2
podman-af2418018b8a0d83734a7a329955f5a9938bdfbf.zip
Merge pull request #8828 from boaz0/closes_8779
Add --all to podman start
Diffstat (limited to 'test')
-rw-r--r--test/system/045-start.bats43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/system/045-start.bats b/test/system/045-start.bats
new file mode 100644
index 000000000..ff818e51d
--- /dev/null
+++ b/test/system/045-start.bats
@@ -0,0 +1,43 @@
+#!/usr/bin/env bats -*- bats -*-
+
+load helpers
+
+@test "podman start --all - start all containers" {
+ # Run a bunch of short-lived containers, with different --restart settings
+ run_podman run -d $IMAGE /bin/true
+ cid_none_implicit="$output"
+ run_podman run -d --restart=no $IMAGE /bin/false
+ cid_none_explicit="$output"
+ run_podman run -d --restart=on-failure $IMAGE /bin/true
+ cid_on_failure="$output"
+
+ # Run one longer-lived one.
+ run_podman run -d --restart=always $IMAGE sleep 20
+ cid_always="$output"
+
+ run_podman wait $cid_none_implicit $cid_none_explicit $cid_on_failure
+
+ run_podman start --all
+ is "$output" ".*$cid_none_implicit" "started: container with no --restart"
+ is "$output" ".*$cid_none_explicit" "started: container with --restart=no"
+ is "$output" ".*$cid_on_failure" "started: container with --restart=on-failure"
+ if [[ $output =~ $cid_always ]]; then
+ die "podman start --all restarted a running container"
+ fi
+
+ run_podman rm $cid_none_implicit $cid_none_explicit $cid_on_failure
+ run_podman stop -t 1 $cid_always
+ run_podman rm $cid_always
+}
+
+@test "podman start --all with incompatible options" {
+ expected="Error: either start all containers or the container(s) provided in the arguments"
+ run_podman 125 start --all 12333
+ is "$output" "$expected" "start --all, with args, throws error"
+ if ! is_remote; then
+ run_podman 125 start --all --latest
+ is "$output" "$expected" "podman start --all --latest"
+ fi
+}
+
+# vim: filetype=sh