Skip to content

Commit 3acc98c

Browse files
committed
Fix matching unordered JSON in cluster test
New NETCONF release added SSH topology-types container to topology. The topology container is unordered ("node" list and "topology-types" container order varies). Fix this by sorting JSON before comparing replies for consistent test results. JIRA: LIGHTY-394 Signed-off-by: Peter Suna <[email protected]>
1 parent b0d8722 commit 3acc98c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/lighty-rnc-app/test-lighty-rnc-app-cluster.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ assertNodeConnected() {
126126

127127
assertPodsTopologyResponse() {
128128
local previousResponse=""
129+
local currentNormalizedResponse=""
129130
for pod_controller_ip in $POD_CONTROLLER_IPS;
130131
do
131132
TOPOLOGY_RESPONSE=$(curl --request GET \
@@ -136,12 +137,14 @@ assertPodsTopologyResponse() {
136137
test_results+=(1)
137138
continue
138139
elif [[ -z "$previousResponse" ]]
140+
# Sort json objects to allow matching unordered JSON reply
141+
currentNormalizedResponse=$(echo "$TOPOLOGY_RESPONSE" | jq -S '.')
139142
then
140143
# First request
141-
echo "first response $TOPOLOGY_RESPONSE"
142-
previousResponse=$TOPOLOGY_RESPONSE
144+
echo "first response $currentNormalizedResponse"
145+
previousResponse=$currentNormalizedResponse
143146
continue
144-
elif [[ "$previousResponse" != "$TOPOLOGY_RESPONSE" ]]
147+
elif [[ "$previousResponse" != "$currentNormalizedResponse" ]]
145148
then
146149
echo "Previous response doesn't match: [ $previousResponse ] with current response : [ $TOPOLOGY_RESPONSE ]"
147150
test_results+=(1)

0 commit comments

Comments
 (0)