Skip to content

Commit

Permalink
test: fix flaky replication/wal_off.test.lua
Browse files Browse the repository at this point in the history
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
  c6bea65 ('replication: recfg with 0
quorum returns immediately').

Closes #4355
  • Loading branch information
avtikhon committed Jun 9, 2020
1 parent e3cf64a commit 1b3fbd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions test/replication/wal_off.result
Expand Up @@ -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 = "" }
---
Expand Down
3 changes: 1 addition & 2 deletions test/replication/wal_off.test.lua
Expand Up @@ -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")
Expand Down

0 comments on commit 1b3fbd2

Please sign in to comment.