]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephadm: add test case to verify custom container init_containers 52178/head
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 25 Jul 2023 17:16:13 +0000 (13:16 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 9 Aug 2023 17:48:43 +0000 (13:48 -0400)
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 <jmulligan@redhat.com>
qa/suites/orch/cephadm/workunits/task/test_extra_daemon_features.yaml

index b5e0ec98f3239c91e0fecd0be3c1876f71212a56..0e825cd11009f3e1c1afd41a2650bf6379778390 100644 (file)
@@ -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