[ovs-dev] [PATCH ovn] ovn-northd.at: Fix race condition in pause and resume test.

Mark Michelson mmichels at redhat.com
Mon May 11 19:38:11 UTC 2020


A recent build failed because the pause and resume test failed. After
resuming northd and northd-backup, the status of northd was "standby"
instead of the expected "active". This happened for one of two reasons:

1) For some reason, northd failed to retrieve the lock between resuming
   and checking its status, so it reported as being "standby".
2) northd-backup won the race to get the lock, so it became the active
   instance instead of northd.

This change alters the test to fix both of these issues. Instead of
resuming both northd and northd-backup, we start by only resuming
northd. We then wait until it reports that it is active before we resume
northd-backup. This way, they are guaranteed to be in the states we
expect.

Signed-off-by: Mark Michelson <mmichels at redhat.com>
---
 tests/ovn-northd.at | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 57c9eedd5..80bda0a15 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -935,10 +935,12 @@ OVS_WAIT_UNTIL([
 
 # Now resume ovn-northd
 as northd ovs-appctl -t ovn-northd resume
-as northd-backup ovs-appctl -t ovn-northd resume
 AT_CHECK([test xfalse = x`as northd ovn-appctl -t ovn-northd is-paused`])
-AT_CHECK([as northd ovn-appctl -t ovn-northd status], [0], [Status: active
+OVS_WAIT_UNTIL([as northd ovn-appctl -t ovn-northd status], [0],
+[Status: active
 ])
+
+as northd-backup ovs-appctl -t ovn-northd resume
 AT_CHECK([test xfalse = x`as northd-backup ovn-appctl -t ovn-northd \
 is-paused`])
 AT_CHECK([as northd-backup ovn-appctl -t ovn-northd status], [0],
-- 
2.25.4



More information about the dev mailing list