diff mbox series

[ovs-dev,v2] ovsdb-cluster.at: Fix race in the disruptive server test.

Message ID cffae96359c2cfd685013edaf2f2ae8a5d727b8d.1786620027.git.tredaelli@redhat.com
State New
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,v2] ovsdb-cluster.at: Fix race in the disruptive server test. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_FreeBSD_Build_and_Test success github build: passed

Commit Message

Timothy Redaelli Aug. 13, 2026, 11:22 a.m. UTC
The last two transactions of the "disruptive server with the old term
and outdated log" test are checked on every server as soon as the
leader replied.  A successful transaction reply only guarantees that
the entry was committed by a majority; a follower may not have learned
the new commit index and applied the entry yet.  The test then reads
stale data with --no-leader-only and fails:

  ./ovsdb-cluster.at:1104: ovs-vsctl --db=unix:s$i.ovsdb --no-leader-only \
      --bare --columns=type list QoS | grep . | sort | tr -d '\n'
    @@ -1 +1 @@
    -lmxyz
    +lxyz

Wait for the data with OVS_WAIT_UNTIL_EQUAL instead of reading it once.

Fixes: 5d1fa6e4a4b0 ("ovsdb-cluster.at: Test disruptive server with outdated log and term.")
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
Changes from v1:
 - Fixed "Fixes" line to use 12 characters hash.
---
 tests/ovsdb-cluster.at | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index 1dd74e3de..323162a1d 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -1098,12 +1098,19 @@  AT_CHECK([ovs-vsctl --db=unix:s1.ovsdb --no-leader-only --no-wait create QoS typ
 AT_CHECK([ovs-vsctl --db=unix:s1.ovsdb --no-leader-only --no-wait create QoS type=m], [0], [ignore], [ignore])
 
 # Check that all the servers are in the cluster and have all the data.
+# A successful transaction reply only guarantees that the entry was committed
+# by a majority.  A follower may not have learned the new commit index and
+# applied it yet, so wait for every server to catch up.
 for i in $(seq $n); do
     AT_CHECK([ovs-appctl -t $(pwd)/s$i cluster/status $schema_name \
                 | grep -qE "Role: (leader|follower)"])
-    AT_CHECK([ovs-vsctl --db=unix:s$i.ovsdb --no-leader-only --bare \
-                --columns=type list QoS | grep . | sort | tr -d '\n'],
-             [0], [lmxyz])
+    OVS_WAIT_UNTIL_EQUAL([ovs-vsctl --db=unix:s$i.ovsdb --no-leader-only \
+                            --bare --columns=type list QoS | grep . | sort], [dnl
+l
+m
+x
+y
+z])
 done
 
 # Check that s3 never won a pre-vote.