github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/system/045-start.bats (about) 1 #!/usr/bin/env bats -*- bats -*- 2 3 load helpers 4 5 @test "podman start --all - start all containers" { 6 # Run a bunch of short-lived containers, with different --restart settings 7 run_podman run -d $IMAGE /bin/true 8 cid_none_implicit="$output" 9 run_podman run -d --restart=no $IMAGE /bin/false 10 cid_none_explicit="$output" 11 run_podman run -d --restart=on-failure $IMAGE /bin/true 12 cid_on_failure="$output" 13 14 # Run one longer-lived one. 15 run_podman run -d --restart=always $IMAGE sleep 20 16 cid_always="$output" 17 18 run_podman wait $cid_none_implicit $cid_none_explicit $cid_on_failure 19 20 run_podman start --all 21 is "$output" ".*$cid_none_implicit" "started: container with no --restart" 22 is "$output" ".*$cid_none_explicit" "started: container with --restart=no" 23 is "$output" ".*$cid_on_failure" "started: container with --restart=on-failure" 24 if [[ $output =~ $cid_always ]]; then 25 die "podman start --all restarted a running container" 26 fi 27 28 run_podman wait $cid_none_implicit $cid_none_explicit $cid_on_failure 29 30 run_podman rm $cid_none_implicit $cid_none_explicit $cid_on_failure 31 run_podman stop -t 1 $cid_always 32 run_podman rm $cid_always 33 } 34 35 @test "podman start --all with incompatible options" { 36 expected="Error: either start all containers or the container(s) provided in the arguments" 37 run_podman 125 start --all 12333 38 is "$output" "$expected" "start --all, with args, throws error" 39 } 40 41 @test "podman start --filter - start only containers that match the filter" { 42 run_podman run -d $IMAGE /bin/true 43 cid="$output" 44 run_podman start --filter restart-policy=always $cid "CID of restart-policy=always container" 45 is "$output" "" 46 47 run_podman start --filter restart-policy=none $cid "CID of restart-policy=none container" 48 is "$output" "$cid" 49 } 50 51 @test "podman start --filter invalid-restart-policy - return error" { 52 run_podman run -d $IMAGE /bin/true 53 cid="$output" 54 run_podman 125 start --filter restart-policy=fakepolicy $cid "CID of restart-policy=<not-exists> container" 55 is "$output" "Error: fakepolicy invalid restart policy" 56 } 57 58 @test "podman start --all --filter" { 59 run_podman run -d $IMAGE /bin/true 60 cid_exited_0="$output" 61 run_podman run -d $IMAGE /bin/false 62 cid_exited_1="$output" 63 64 run_podman wait $cid_exited_0 $cid_exited_1 65 run_podman start --all --filter exited=0 66 is "$output" "$cid_exited_0" 67 } 68 69 # vim: filetype=sh