From 6cf8bed0b7f846eab008ae1a60f3f313ef66d8f9 Mon Sep 17 00:00:00 2001 From: "Alexander V. Tikhonov" Date: Tue, 9 Jun 2020 21:34:27 +0300 Subject: [PATCH] test: fix flaky replication/wal_off.test.lua Found issue: [003] --- replication/wal_off.result Thu Apr 25 13:10:18 2019 [003] +++ replication/wal_off.reject Tue Jul 16 17:10:31 2019 [003] @@ -95,6 +95,8 @@ [003] ... [003] while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end [003] --- [003] +- error: '[string "while string.find(box.info.replication[wal_of..."]:1: bad argument [003] + #1 to ''find'' (string expected, got nil)' [003] ... [003] box.cfg { replication = "" } [003] --- To check the upstream status and it's message need to wait until an upstream appears. This prevents an attempt to index a nil value when one of those functions are called before a record about a peer appears in box.info.replication. It was observed on test: replication/show_error_on_disconnect after commit c6bea65f8ef5f6c737cf70c0127189d0ebcbc36e ('replication: recfg with 0 quorum returns immediately'). Closes #4355 (cherry picked from commit 3e9044751ebfac9dc411c66fefb8f53b31f779d0) --- test/replication/suite.ini | 1 - test/replication/wal_off.result | 6 ++---- test/replication/wal_off.test.lua | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/test/replication/suite.ini b/test/replication/suite.ini index 6a8944020083..3aa957c60841 100644 --- a/test/replication/suite.ini +++ b/test/replication/suite.ini @@ -17,7 +17,6 @@ fragile = errinj.test.lua ; gh-3870 skip_conflict_row.test.lua ; gh-4958 sync.test.lua ; gh-3835 gh-3877 transaction.test.lua ; gh-4312 - wal_off.test.lua ; gh-4355 wal_rw_stress.test.lua ; gh-4977 replica_rejoin.test.lua ; gh-4985 recover_missing_xlog.test.lua ; gh-4989 diff --git a/test/replication/wal_off.result b/test/replication/wal_off.result index e0ae84bd7c4e..f69e588933ed 100644 --- a/test/replication/wal_off.result +++ b/test/replication/wal_off.result @@ -90,11 +90,9 @@ box.cfg { replication = wal_off_uri } box.cfg { replication_sync_timeout = replication_sync_timeout } --- ... -check = "Read access to universe" ---- -... -while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end +test_run:wait_upstream(wal_off_id, {status = 'loading', message_re = "Read access to universe"}) --- +- true ... box.cfg { replication = "" } --- diff --git a/test/replication/wal_off.test.lua b/test/replication/wal_off.test.lua index 110f2f1f7ec4..7298ba1d8a33 100644 --- a/test/replication/wal_off.test.lua +++ b/test/replication/wal_off.test.lua @@ -31,8 +31,7 @@ replication_sync_timeout = box.cfg.replication_sync_timeout box.cfg { replication_sync_timeout = 0.01 } box.cfg { replication = wal_off_uri } box.cfg { replication_sync_timeout = replication_sync_timeout } -check = "Read access to universe" -while string.find(box.info.replication[wal_off_id].upstream.message, check) == nil do fiber.sleep(0.01) end +test_run:wait_upstream(wal_off_id, {status = 'loading', message_re = "Read access to universe"}) box.cfg { replication = "" } test_run:cmd("stop server wal_off")