]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: add test for deployment of the cephadm exporter mode
authorPaul Cuzner <pcuzner@redhat.com>
Mon, 21 Sep 2020 03:53:36 +0000 (15:53 +1200)
committerPaul Cuzner <pcuzner@redhat.com>
Mon, 21 Sep 2020 03:53:36 +0000 (15:53 +1200)
Updated the testscript to include the deployment of exporter mode
and check the content of the API service returns valid JSON.

Signed-off-by: Paul Cuzner <pcuzner@redhat.com>
qa/workunits/cephadm/test_cephadm.sh

index e0f038db17875289e98a3cc1212fbf2d84e885ec..f897e97eaef7904100d4b8c912e44728f0a29338 100755 (executable)
@@ -292,6 +292,12 @@ $CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \
       ceph -s -f json-pretty \
     | jq '.mgrmap.num_standbys' | grep -q 1
 
+# deploy cephadm in exporter mode - query the API later in the test
+# to give the daemon time to scan
+$CEPHADM deploy --name cephadm.x \
+      --fsid $FSID \
+      --tcp-ports 5003
+
 # add osd.{1,2,..}
 dd if=/dev/zero of=$TMPDIR/$OSD_IMAGE_NAME bs=1 count=0 seek=$OSD_IMAGE_SIZE
 loop_dev=$($SUDO losetup -f)
@@ -332,6 +338,23 @@ for id in `seq 0 $((--OSD_TO_CREATE))`; do
           --osd-fsid $osd_fsid
 done
 
+# now check the output from the cephadm exporter is json for all the 
+# supported endpoints
+cond="curl 'http://localhost:5003/v1/metadata/health' | jq -e '.tasks.daemons == \"active\" and .tasks.host == \"active\" and .tasks.disks == \"active\"'"
+is_available "cephadm exporter health" "$cond" 3
+cond="curl 'http://localhost:5003/v1/metadata/host' | jq -e '.data'"
+is_available "cephadm exporter host output" "$cond" 3
+cond="curl 'http://localhost:5003/v1/metadata/daemons' | jq -e '.data'"
+is_available "cephadm exporter list-daemons output" "$cond" 3
+cond="curl 'http://localhost:5003/v1/metadata/disks' | jq -e '.data'"
+is_available "cephadm exporter ceph-volume output" "$cond" 5
+
+http_status=$(curl -i 'http://localhost:5003/badurl' | head -n 1| cut -d$' ' -f2)
+(("$http_status" == "404"))
+
+cond="curl 'http://localhost:5003' | grep ^'<!DOCTYPE html>'"
+is_available "cephadm exporter default HTML page" "$cond" 1
+
 # add node-exporter
 ${CEPHADM//--image $IMAGE_MASTER/} deploy \
     --name node-exporter.a --fsid $FSID