Skip to content

Commit

Permalink
test: fix flaky failover/failover.test.lua
Browse files Browse the repository at this point in the history
Router pings replicas and if they cannot respond in
failover_ping_timeout, it detaches connection from this replica.
The test checks, that connection is not closed, when long response is
done, even if failover_ping_timeout is small.

However, when the connection is detached, it can be garbage collected,
which leads to 'Connection closed' error. Let's stop Lua GC for the
connection by creating reference to it.

Related to tarantool/tarantool#9629

NO_DOC=test
  • Loading branch information
Serpentian authored and Gerold103 committed Jan 30, 2024
1 parent f119267 commit 8e3bce5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/failover/failover.result
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ while rs.master ~= rs.replica do fiber.sleep(0.01) end
future = nil
---
...
-- Create strong reference to prevent Lua GC from closing the
-- connection. Waiting for tarantool/tarantool#9629 to be fixed.
conn = rs.master.conn
---
...
while not future do fiber.sleep(0.01) future = vshard.router.callrw(31, 'echo', {t}, {is_async = true}) end
---
...
Expand Down
3 changes: 3 additions & 0 deletions test/failover/failover.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ t = string.rep('a', 1024 * 1024 * 500)
rs = vshard.router.route(31)
while rs.master ~= rs.replica do fiber.sleep(0.01) end
future = nil
-- Create strong reference to prevent Lua GC from closing the
-- connection. Waiting for tarantool/tarantool#9629 to be fixed.
conn = rs.master.conn
while not future do fiber.sleep(0.01) future = vshard.router.callrw(31, 'echo', {t}, {is_async = true}) end
vshard.router.static.failover_fiber:wakeup()
res, err = future:wait_result(5)
Expand Down

0 comments on commit 8e3bce5

Please sign in to comment.