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, as the connection is detached, it can be garbage collected,
which leads to error. Let's stop garbage collection for this test.

NO_DOC=test
  • Loading branch information
Serpentian committed Jan 26, 2024
1 parent f119267 commit 461c569
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/failover/failover.result
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ vshard.router.cfg(cfg)
while not test_run:grep_log('router_1', 'Ping error from', 1000) do fiber.sleep(0.01) end
---
...
collectgarbage("stop")
---
- 0
...
t = string.rep('a', 1024 * 1024 * 500)
---
...
Expand Down Expand Up @@ -508,6 +512,10 @@ err
---
- 524288000
...
collectgarbage("restart")
---
- 0
...
cfg.failover_ping_timeout = nil
---
...
Expand Down
2 changes: 2 additions & 0 deletions test/failover/failover.test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ cfg.failover_ping_timeout = 0.0000001
vshard.router.cfg(cfg)
while not test_run:grep_log('router_1', 'Ping error from', 1000) do fiber.sleep(0.01) end

collectgarbage("stop")
t = string.rep('a', 1024 * 1024 * 500)
rs = vshard.router.route(31)
while rs.master ~= rs.replica do fiber.sleep(0.01) end
Expand All @@ -186,6 +187,7 @@ vshard.router.static.failover_fiber:wakeup()
res, err = future:wait_result(5)
err
#res[1]
collectgarbage("restart")
cfg.failover_ping_timeout = nil
vshard.router.cfg(cfg)

Expand Down

0 comments on commit 461c569

Please sign in to comment.