]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/suites/rbd: fix sporadic "rx-only direction" test failures 50071/head
authorIlya Dryomov <idryomov@gmail.com>
Fri, 10 Feb 2023 12:56:57 +0000 (13:56 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 10 Feb 2023 14:26:27 +0000 (15:26 +0100)
The existing

    xmlstarlet sel -t -v  '//mirror/peers/peer[1]/uuid')" = ""

test is bogus since a tx-only peer gets added after the remote
rbd-mirror daemon pings the local cluster.  It happened to pass most
of the time because xmlstarlet filter just failed on an empty peers
array, producing the wrongly expected empty string by accident.

Fixes: https://tracker.ceph.com/issues/58688
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/workunits/rbd/rbd_mirror_bootstrap.sh

index fb77c0d9bf869f5665042c4666e5ce30446296dd..6ef06f2b82cbb27d56b9afd91b00c2402e487266 100755 (executable)
@@ -24,8 +24,13 @@ start_mirrors ${CLUSTER1}
 start_mirrors ${CLUSTER2}
 
 testlog "TEST: verify rx-only direction"
-[ "$(rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format xml |
-       ${XMLSTARLET} sel -t -v  '//mirror/peers/peer[1]/uuid')" = "" ]
+# rx-only peer is added immediately by "rbd mirror pool peer bootstrap import"
+rbd --cluster ${CLUSTER2} --pool ${POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-only"'
+# tx-only peer is added asynchronously by mirror_peer_ping class method
+while ! rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format json | jq -e '.peers | length > 0'; do
+    sleep 1
+done
+rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format json | jq -e '.peers[0].direction == "tx-only"'
 
 create_image_and_enable_mirror ${CLUSTER1} ${POOL} image1
 
@@ -34,6 +39,10 @@ write_image ${CLUSTER1} ${POOL} image1 100
 wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} image1
 
 testlog "TEST: verify rx-tx direction"
+# both rx-tx peers are added immediately by "rbd mirror pool peer bootstrap import"
+rbd --cluster ${CLUSTER1} --pool ${PARENT_POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-tx"'
+rbd --cluster ${CLUSTER2} --pool ${PARENT_POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-tx"'
+
 create_image ${CLUSTER1} ${PARENT_POOL} image1
 create_image ${CLUSTER2} ${PARENT_POOL} image2