]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/standalone/mon/availability.sh: add test for config option 63159/head
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 29 May 2025 10:10:01 +0000 (15:40 +0530)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Thu, 12 Jun 2025 10:50:25 +0000 (16:20 +0530)
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 <shraddhaag@ibm.com>
qa/standalone/mon/availability.sh

index a0c78089f9ff86f599c4c993bc500784efcdd94f..0d8f235def28a7e0ae80998ef0b37d8141f71f55 100755 (executable)
@@ -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