From 1215f7077781f938be303eddb7e3d974b332f3dd Mon Sep 17 00:00:00 2001 From: Paul Cuzner Date: Mon, 21 Sep 2020 15:53:36 +1200 Subject: [PATCH] cephadm: add test for deployment of the cephadm exporter mode 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 --- qa/workunits/cephadm/test_cephadm.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index e0f038db17875..f897e97eaef79 100755 --- a/qa/workunits/cephadm/test_cephadm.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -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 ^''" +is_available "cephadm exporter default HTML page" "$cond" 1 + # add node-exporter ${CEPHADM//--image $IMAGE_MASTER/} deploy \ --name node-exporter.a --fsid $FSID -- 2.39.5