Skip to content

Commit c66eea2

Browse files
authored
Fix flaky tests (#1551)
Retry some assertions to fix following tests: - `integration.restart_replication.test_suggestions` - `integration.api_query.test_suggestions`
1 parent 6c789d5 commit c66eea2

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

test/integration/api_query_test.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ g.before_all = function()
119119
end)
120120
end
121121

122+
g.before_each(function()
123+
helpers.retrying({}, function()
124+
t.assert_equals(helpers.list_cluster_issues(g.cluster.main_server), {})
125+
end)
126+
end)
127+
122128
g.after_all = function()
123129
g.cluster:stop()
124130
g.server:stop()
@@ -674,8 +680,6 @@ end
674680

675681

676682
function g.test_issues()
677-
t.assert_equals(helpers.list_cluster_issues(g.cluster.main_server), {})
678-
679683
-----------------------------------------------------------------------------
680684
-- memory usage issues
681685
local server = g.cluster:server('storage')

test/integration/restart_replication_test.lua

+15-12
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ function g.test_suggestion()
3838
message = "Replication from localhost:13302 (A-2)" ..
3939
" to localhost:13301 (A-1) isn't running",
4040
}
41-
42-
t.assert_equals(h.list_cluster_issues(g.A1), {replication_issue})
43-
t.assert_items_equals(
44-
h.get_suggestions(g.A1).restart_replication,
45-
{{uuid = g.A1.instance_uuid}}
46-
)
41+
h.retrying({}, function()
42+
t.assert_equals(h.list_cluster_issues(g.A1), {replication_issue})
43+
t.assert_items_equals(
44+
h.get_suggestions(g.A1).restart_replication,
45+
{{uuid = g.A1.instance_uuid}}
46+
)
47+
end)
4748

4849
g.A2.process:kill('STOP')
4950

@@ -52,11 +53,13 @@ function g.test_suggestion()
5253

5354
g.A2.process:kill('CONT')
5455

55-
t.assert_equals(h.list_cluster_issues(g.A1), {replication_issue})
56-
t.assert_items_equals(
57-
h.get_suggestions(g.A1).restart_replication,
58-
{{uuid = g.A1.instance_uuid}}
59-
)
56+
h.retrying({}, function()
57+
t.assert_equals(h.list_cluster_issues(g.A1), {replication_issue})
58+
t.assert_items_equals(
59+
h.get_suggestions(g.A1).restart_replication,
60+
{{uuid = g.A1.instance_uuid}}
61+
)
62+
end)
6063

6164
g.A1:graphql({
6265
query = [[
@@ -69,7 +72,7 @@ function g.test_suggestion()
6972
variables = {uuids = {g.A1.instance_uuid}}
7073
})
7174

72-
t.helpers.retrying({}, function()
75+
h.retrying({}, function()
7376
t.assert_equals(h.list_cluster_issues(g.A1), {})
7477
t.assert_equals(h.get_suggestions(g.A1).restart_replication, nil)
7578
end)

0 commit comments

Comments
 (0)