diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-12 13:35:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-12 13:35:56 -0400 |
commit | 81fc9f1deae7e92a298f3aee3a87cc4362123ea9 (patch) | |
tree | c54c4383181dd499f9e22334ca1ece71a20dabff /test/system/700-play.bats | |
parent | 45e9f1ff097adca65a5bb2a7367883508900667d (diff) | |
parent | 840c120c21124de921a7f57435cf0d0497103736 (diff) | |
download | podman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.tar.gz podman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.tar.bz2 podman-81fc9f1deae7e92a298f3aee3a87cc4362123ea9.zip |
Merge pull request #14159 from vrothberg/service-container
play kube: service container
Diffstat (limited to 'test/system/700-play.bats')
-rw-r--r-- | test/system/700-play.bats | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/system/700-play.bats b/test/system/700-play.bats index 7988b26a4..2e5327a85 100644 --- a/test/system/700-play.bats +++ b/test/system/700-play.bats @@ -100,6 +100,61 @@ RELABEL="system_u:object_r:container_file_t:s0" run_podman pod rm -t 0 -f test_pod } +@test "podman play --service-container" { + skip_if_remote "service containers only work locally" + + TESTDIR=$PODMAN_TMPDIR/testdir + mkdir -p $TESTDIR + +yaml=" +apiVersion: v1 +kind: Pod +metadata: + labels: + app: test + name: test_pod +spec: + containers: + - command: + - top + image: $IMAGE + name: test + resources: {} +" + + echo "$yaml" > $PODMAN_TMPDIR/test.yaml + run_podman play kube --service-container=true $PODMAN_TMPDIR/test.yaml + + # Make sure that the service container exists and runs. + run_podman container inspect "352a88685060-service" --format "{{.State.Running}}" + is "$output" "true" + + # Stop the *main* container and make sure that + # 1) The pod transitions to Exited + # 2) The service container is stopped + # #) The service container is marked as an service container + run_podman stop test_pod-test + _ensure_pod_state test_pod Exited + run_podman container inspect "352a88685060-service" --format "{{.State.Running}}" + is "$output" "false" + run_podman container inspect "352a88685060-service" --format "{{.IsService}}" + is "$output" "true" + + # Restart the pod, make sure the service is running again + run_podman pod restart test_pod + run_podman container inspect "352a88685060-service" --format "{{.State.Running}}" + is "$output" "true" + + # Kill the pod and make sure the service is not running + run_podman pod kill test_pod + run_podman container inspect "352a88685060-service" --format "{{.State.Running}}" + is "$output" "false" + + # Remove the pod and make sure the service is removed along with it + run_podman pod rm test_pod + run_podman 1 container exists "352a88685060-service" +} + @test "podman play --network" { TESTDIR=$PODMAN_TMPDIR/testdir mkdir -p $TESTDIR |