From: John Mulligan Date: Tue, 25 Jul 2023 17:16:13 +0000 (-0400) Subject: qa/cephadm: add test case to verify custom container init_containers X-Git-Tag: v19.0.0~711^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=921f474b6dc9f55ba99a8047d1c8105e806b87e8;p=ceph.git qa/cephadm: add test case to verify custom container init_containers Add a 2nd custom container yaml to the test_extra_daemon_features.yaml file that uses two init containers. Add verification that the init containers (and primary) ran successfully. Signed-off-by: John Mulligan --- diff --git a/qa/suites/orch/cephadm/workunits/task/test_extra_daemon_features.yaml b/qa/suites/orch/cephadm/workunits/task/test_extra_daemon_features.yaml index b5e0ec98f3239..0e825cd11009f 100644 --- a/qa/suites/orch/cephadm/workunits/task/test_extra_daemon_features.yaml +++ b/qa/suites/orch/cephadm/workunits/task/test_extra_daemon_features.yaml @@ -52,10 +52,50 @@ tasks: done echo $CONTENT > $OUT_FILE sleep infinity + - service_type: container + service_id: bar + placement: + host_pattern: '*' + spec: + image: "quay.io/fedora/fedora:latest" + entrypoint: "bash" + dirs: + - data + volume_mounts: + data: /var/cache/bar:z + init_containers: + # use a different image, just for checking it can be passed + - image: quay.io/centos/centos:latest + entrypoint: bash + entrypoint_args: + - argument: "-c" + - argument: ". /etc/os-release && echo from=$ID > /var/cache/bar/from.txt" + volume_mounts: + data: /var/cache/bar:z + # ensure from.txt got created, run 2nd init step + - entrypoint: bash + entrypoint_args: + - argument: "-c" + - argument: "test -f /var/cache/bar/from.txt && truncate -s 102400 /var/cache/bar/presized.dat" + volume_mounts: + data: /var/cache/bar:z + # end init_containers + extra_entrypoint_args: + - "/root/init_check.sh" + custom_configs: + - mount_path: "/root/init_check.sh" + content: | + set -e + test -f /var/cache/bar/from.txt + test -f /var/cache/bar/presized.dat + echo ok > /var/cache/bar/primary.txt + sleep infinity - cephadm.wait_for_service: service: mon - cephadm.wait_for_service: service: container.foo +- cephadm.wait_for_service: + service: container.bar - exec: host.a: - | @@ -72,3 +112,10 @@ tasks: # the content and where to write to with the entrypoint args, and the mounting # of the /etc/cephadm_testing dir with extra container args grep "testing_custom_containers" /etc/cephadm_testing/testing.txt + # Verify that container bar's init containers and primary container + # ran successfully + dir=$(find /var/lib/ceph/$FSID -maxdepth 1 -type d -name 'container.bar.*') + test -n "$dir" + grep ok ${dir}/data/primary.txt + grep from=centos ${dir}/data/from.txt + test -s ${dir}/data/presized.dat