Skip to content

Commit

Permalink
test: fix flaky persistent triggers test
Browse files Browse the repository at this point in the history
The replication test of persistent triggers was waiting only for
the persistent triggers to arrive on replica, so the replica tried
to write to the space which was not created there yet. Let's wait
for all changes to arrive to make the test stable.

Closes #9967

NO_CHANGELOG=test
NO_DOC=test

(cherry picked from commit 927e351)
  • Loading branch information
drewdzzz authored and sergepetrenko committed Apr 24, 2024
1 parent 151d057 commit 0e5607e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/box-luatest/gh_8663_persistent_triggers_test.lua
Expand Up @@ -283,21 +283,16 @@ g.test_replicated_non_idempotent_trigger = function(g)
box.space.weights:replace{'elephant', 4000}
box.space.weights:replace{'crocodile', 600}
end)
-- Wait for the trigger and the space to arrive on the second server
g.server2:wait_for_vclock_of(g.server1)
g.server2:exec(function()
-- Wait for a trigger to arrive
while box.func['example.replicated_trigger'] == nil do
require('fiber').sleep(0)
end
box.space.weights:replace{'cat', 6}
box.space.weights:replace{'dog', 10}
end)

-- Check result
-- Wait for the writes to arrive on the first server
g.server1:wait_for_vclock_of(g.server2)
local check_case = function(expected_result)
-- Wait for both servers
while box.space.weights:count() ~= 4 do
require('fiber').sleep(0)
end
t.assert_equals(box.space.weights:select(nil, {fullscan=true}),
expected_result)
end
Expand Down

0 comments on commit 0e5607e

Please sign in to comment.