@@ -4,6 +4,7 @@ local ReplicaSet = require('luatest.replica_set')
44
55local g = t .group ()
66local Server = t .Server
7+ local deferred_artifact_checks = {}
78
89g .before_each (function ()
910 g .rs = ReplicaSet :new ()
@@ -33,23 +34,26 @@ g.before_test('test_save_rs_artifacts_when_test_failed', function()
3334end )
3435
3536g .test_save_rs_artifacts_when_test_failed = function ()
36- local test = rawget (_G , ' current_test' )
37+ local ctx = rawget (_G , ' current_test' )
38+ local test = ctx .value
3739 -- the test must be failed to save artifacts
38- test . status = ' fail'
40+ ctx . runner : update_status ( test , { status = ' fail' })
3941 g .rs :drop ()
40- test . status = ' success'
42+ test : update_status ( ' success' )
4143
42- t .assert_equals (fio .path .exists (g .rs_artifacts ), true )
43- t .assert_equals (fio .path .is_dir (g .rs_artifacts ), true )
44+ table.insert (deferred_artifact_checks , function ()
45+ t .assert_equals (fio .path .exists (g .rs_artifacts ), true )
46+ t .assert_equals (fio .path .is_dir (g .rs_artifacts ), true )
4447
45- t .assert_equals (fio .path .exists (g .s1_artifacts ), true )
46- t .assert_equals (fio .path .is_dir (g .s1_artifacts ), true )
48+ t .assert_equals (fio .path .exists (g .s1_artifacts ), true )
49+ t .assert_equals (fio .path .is_dir (g .s1_artifacts ), true )
4750
48- t .assert_equals (fio .path .exists (g .s2_artifacts ), true )
49- t .assert_equals (fio .path .is_dir (g .s2_artifacts ), true )
51+ t .assert_equals (fio .path .exists (g .s2_artifacts ), true )
52+ t .assert_equals (fio .path .is_dir (g .s2_artifacts ), true )
5053
51- t .assert_equals (fio .path .exists (g .s3_artifacts ), true )
52- t .assert_equals (fio .path .is_dir (g .s3_artifacts ), true )
54+ t .assert_equals (fio .path .exists (g .s3_artifacts ), true )
55+ t .assert_equals (fio .path .is_dir (g .s3_artifacts ), true )
56+ end )
5357end
5458
5559g .before_test (' test_save_rs_artifacts_when_server_workdir_passed' , function ()
@@ -69,26 +73,35 @@ g.before_test('test_save_rs_artifacts_when_server_workdir_passed', function()
6973end )
7074
7175g .test_save_rs_artifacts_when_server_workdir_passed = function ()
72- local test = rawget (_G , ' current_test' )
76+ local ctx = rawget (_G , ' current_test' )
77+ local test = ctx .value
7378 -- the test must be failed to save artifacts
74- test . status = ' fail'
79+ ctx . runner : update_status ( test , { status = ' fail' })
7580 g .rs :drop ()
76- test . status = ' success'
81+ test : update_status ( ' success' )
7782
78- t .assert_equals (fio .path .exists (g .rs_artifacts ), true )
79- t .assert_equals (fio .path .is_dir (g .rs_artifacts ), true )
83+ table.insert (deferred_artifact_checks , function ()
84+ t .assert_equals (fio .path .exists (g .rs_artifacts ), true )
85+ t .assert_equals (fio .path .is_dir (g .rs_artifacts ), true )
8086
81- t .assert_equals (fio .path .exists (g .s1_artifacts ), true )
82- t .assert_equals (fio .path .is_dir (g .s1_artifacts ), true )
87+ t .assert_equals (fio .path .exists (g .s1_artifacts ), true )
88+ t .assert_equals (fio .path .is_dir (g .s1_artifacts ), true )
8389
84- t .assert_equals (fio .path .exists (g .s2_artifacts ), true )
85- t .assert_equals (fio .path .is_dir (g .s2_artifacts ), true )
90+ t .assert_equals (fio .path .exists (g .s2_artifacts ), true )
91+ t .assert_equals (fio .path .is_dir (g .s2_artifacts ), true )
8692
87- t .assert_equals (fio .path .exists (g .s3_artifacts ), true )
88- t .assert_equals (fio .path .is_dir (g .s3_artifacts ), true )
93+ t .assert_equals (fio .path .exists (g .s3_artifacts ), true )
94+ t .assert_equals (fio .path .is_dir (g .s3_artifacts ), true )
95+ end )
8996
9097end
9198
99+ g .after_all (function ()
100+ for _ , check in ipairs (deferred_artifact_checks ) do
101+ check ()
102+ end
103+ end )
104+
92105g .test_rs_no_socket_collision_with_custom_alias = function ()
93106 local s1 = g .rs :build_server ({alias = ' foo' })
94107 local s2 = g .rs :build_server ({alias = ' bar' })
0 commit comments