Skip to content

Commit b4fbc95

Browse files
committed
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 <[email protected]> (cherry picked from commit dc9ee94)
1 parent 3b31212 commit b4fbc95

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

qa/standalone/mon/availability.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,30 @@ function TEST_availablity_score() {
5757
AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo")
5858
SCORE=$(echo "$AVAILABILITY_STATUS" | awk '{print $7}')
5959
IS_AVAILABLE=$(echo "$AVAILABILITY_STATUS" | awk '{print $8}')
60+
UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}')
61+
UPTIME_SECONDS=$(( ${UPTIME_DURATION%[sm]} * (${UPTIME_DURATION: -1} == "m" ? 60 : 1) ))
6062
if [ $IS_AVAILABLE -ne 1 ]; then
6163
echo "Failed: Pool is not available in availabilty status"
64+
return 1
65+
fi
66+
67+
# unset config option enable_availability_tracking to disable feature
68+
ceph config set mon enable_availability_tracking false
69+
AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo")
70+
if [ "$AVAILABILITY_STATUS" != "" ]; then
71+
echo "Failed: feature not disabled successfully."
72+
return 1
73+
fi
74+
sleep 120
75+
76+
# enable feature and check is score updated when it was off
77+
ceph config set mon enable_availability_tracking true
78+
AVAILABILITY_STATUS=$(ceph osd pool availability-status | grep -w "foo")
79+
UPTIME_DURATION=$(echo "$AVAILABILITY_STATUS" | awk '{print $2}')
80+
NEW_UPTIME_SECONDS=$(( ${UPTIME_DURATION%[sm]} * (${UPTIME_DURATION: -1} == "m" ? 60 : 1) ))
81+
if [ "$NEW_UPTIME_SECONDS" -gt $((UPTIME_SECONDS + 120)) ]; then
82+
echo "Failed: score is updated even when feature is disabled"
83+
return 1
6284
fi
6385

6486
# write some objects

0 commit comments

Comments
 (0)