From: Shraddha Agrawal Date: Thu, 29 May 2025 10:10:01 +0000 (+0530) Subject: qa/standalone/mon/availability.sh: add test for config option X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dc9ee94a8dc787324b898822fdaebfb83dfc7e37;p=ceph.git qa/standalone/mon/availability.sh: add test for config option This commit adds two tests, first, to ensure we get an error message when the feature is disabled. It checks if the config option, enable_availability_tracking is working properly. Second test ensures that we actually do stop calculating the score when the feature is disabled. Fixes: https://tracker.ceph.com/issues/71494 Signed-off-by: Shraddha Agrawal --- diff --git a/qa/standalone/mon/availability.sh b/qa/standalone/mon/availability.sh index a0c78089f9ff8..0d8f235def28a 100755 --- a/qa/standalone/mon/availability.sh +++ b/qa/standalone/mon/availability.sh @@ -57,8 +57,30 @@ function TEST_availablity_score() { AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo") SCORE=$(echo "$AVAILABILITY_STATUS" | awk '{print $7}') IS_AVAILABLE=$(echo "$AVAILABILITY_STATUS" | awk '{print $8}') + UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}') + UPTIME_SECONDS=$(( ${UPTIME_DURATION%[sm]} * (${UPTIME_DURATION: -1} == "m" ? 60 : 1) )) if [ $IS_AVAILABLE -ne 1 ]; then echo "Failed: Pool is not available in availabilty status" + return 1 + fi + + # unset config option enable_availability_tracking to disable feature + ceph config set mon enable_availability_tracking false + AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo") + if [ "$AVAILABILITY_STATUS" != "" ]; then + echo "Failed: feature not disabled successfully." + return 1 + fi + sleep 120 + + # enable feature and check is score updated when it was off + ceph config set mon enable_availability_tracking true + AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo") + UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}') + NEW_UPTIME_SECONDS=$(( ${UPTIME_DURATION%[sm]} * (${UPTIME_DURATION: -1} == "m" ? 60 : 1) )) + if [ "$NEW_UPTIME_SECONDS" -gt $((UPTIME_SECONDS + 120)) ]; then + echo "Failed: score is updated even when feature is disabled" + return 1 fi # write some objects