Skip to content

Commit 737082f

Browse files
Tomer HaskalovitchHezko
authored andcommitted
add blocklist test and also add verification in state transition test
Signed-off-by: hezko <tomer.haska@gmail.com>
1 parent 3934c4c commit 737082f

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.github/workflows/build-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ jobs:
538538
strategy:
539539
fail-fast: false
540540
matrix:
541-
test: ["sanity", "ns_lb_change", "no_subsystems", "state_transitions", "state_transitions_both_gws", "state_transitions_loop", "state_transitions_rand_loop", "late_registration", "late_registration_loop", "4gws", "4gws_loop", "4gws_create_delete", "4gws_create_delete_loop", "namespaces", "namespaces_loop", "mtls", "notify", "ceph_status"]
541+
test: ["sanity", "ns_lb_change", "no_subsystems", "state_transitions", "state_transitions_both_gws", "state_transitions_loop", "state_transitions_rand_loop", "late_registration", "late_registration_loop", "4gws", "4gws_loop", "4gws_create_delete", "4gws_create_delete_loop", "namespaces", "namespaces_loop", "mtls", "notify", "ceph_status", "blocklist"]
542542
runs-on: ubuntu-latest
543543
env:
544544
HUGEPAGES: 1024 # 4 spdk instances

tests/ha/blocklist.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
source .env
2+
3+
verify_blocklist() {
4+
stopped_gw_name=$1
5+
NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $stopped_gw_name)
6+
BLOCKLIST=$(docker compose exec -T ceph ceph osd blocklist ls)
7+
8+
echo "verifying there is at least 1 entry in the blocklist related to the stopped gateway"
9+
if echo "$BLOCKLIST" | grep -q "$NODE_IP"; then
10+
echo "ip $NODE_IP for the stopped gateway was found the blocklist."
11+
else
12+
echo "ip $NODE_IP for node the stopped gateway was not found in blocklist."
13+
exit 1
14+
fi
15+
16+
echo "verifying there are no entries in the blocklist which are not related to the stopped gateway"
17+
if echo "$BLOCKLIST" | grep -qv "$NODE_IP"; then
18+
echo "found at least 1 entry in blocklist which is not related to gateway in the stopped gateway. failing"
19+
exit 1
20+
else
21+
echo "didn't find unexpected entries which are not relaetd to the stopped gateway."
22+
fi
23+
echo "blocklist verification successful"
24+
}
25+
26+
echo "obtaining gw1 container id and its ip"
27+
GW1_NAME=$(docker ps --format '{{.ID}}\t{{.Names}}' | awk '$2 ~ /nvmeof/ && $2 ~ /1/ {print $1}')
28+
29+
echo "clearing blocklist"
30+
docker compose exec -T ceph ceph osd blocklist clear
31+
32+
echo "shutting down gw1:$GW1_NAME"
33+
docker stop $GW1_NAME
34+
35+
echo "waiting for 30s after shutdown"
36+
sleep 30
37+
38+
verify_blocklist "$GW1_NAME"

tests/ha/state_transitions.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,29 @@ verify_ana_groups() {
6565
fi
6666
}
6767

68+
verify_blocklist() {
69+
stopped_gw_name=$1
70+
NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $stopped_gw_name)
71+
BLOCKLIST=$(docker compose exec -T ceph ceph osd blocklist ls)
72+
73+
echo "verifying there is at least 1 entry in the blocklist related to the stopped gateway"
74+
if echo "$BLOCKLIST" | grep -q "$NODE_IP"; then
75+
echo "ip $NODE_IP for the stopped gateway was found the blocklist."
76+
else
77+
echo "ip $NODE_IP for node the stopped gateway was not found in blocklist."
78+
exit 1
79+
fi
80+
81+
echo "verifying there are no entries in the blocklist which are not related to the stopped gateway"
82+
if echo "$BLOCKLIST" | grep -qv "$NODE_IP"; then
83+
echo "found at least 1 entry in blocklist which is not related to gateway in the stopped gateway. failing"
84+
exit 1
85+
else
86+
echo "didn't find unexpected entries which are not relaetd to the stopped gateway."
87+
fi
88+
echo "blocklist verification successful"
89+
}
90+
6891
#
6992
# MAIN
7093
#
@@ -94,6 +117,7 @@ GW1_FAILOVER_OPTIMIZED=$(expect_optimized $GW1_NAME 2)
94117
gw1_ana1=$(access_number_by_index "$GW1_FAILOVER_OPTIMIZED" 0)
95118
gw1_ana2=$(access_number_by_index "$GW1_FAILOVER_OPTIMIZED" 1)
96119
verify_ana_groups "$gw1_ana1" "$gw1_ana2"
120+
verify_blocklist "$GW2_NAME"
97121

98122
#
99123
# Step 3 failback

0 commit comments

Comments
 (0)