Skip to content

Commit cfaaefc

Browse files
elhimovbigbes
authored andcommitted
test: fix flaky test_restart_simple_app_auto_yes
The patch add proper check that tarantool is started. Also logging was improved to get more information in case of failure. Closes TNTP-7654
1 parent a79931c commit cfaaefc

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def tt_app(tt, tt_path, tt_instances, tt_running_targets, tt_post_start):
273273
p = tt.run("start", target)
274274
assert p.returncode == 0
275275
app.running_instances = app.instances_of(*tt_running_targets)
276+
assert tt_helper.wait_status(5, app, app.running_instances, ["RUNNING"])
276277
if tt_post_start is not None:
277278
tt_post_start(app)
278279
yield app

test/integration/restart/test_restart.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ def check_restart(tt, tt_app, target, input, is_confirm, *args):
109109
for inst in tt_app.instances:
110110
was_running = inst in tt_app.running_instances
111111
if is_confirm and inst in target_instances:
112+
if status[inst]["STATUS"] != "RUNNING":
113+
with open(tt_app.log_path(inst, utils.log_file)) as f:
114+
print(f"log of instance {inst} ======")
115+
print(f.read())
116+
print("=============================")
117+
assert False
112118
assert status[inst]["STATUS"] == "RUNNING"
113119
assert f"Starting an instance [{inst}]" in out
114120
if was_running:

test/tt_helper.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,21 @@ def are_all_box_statuses_acceptable(tt, instances, acceptable_statuses):
251251
)
252252

253253

254+
def wait_status(timeout, tt_app, instances, acceptable_statuses, interval=0.1):
255+
def are_all_statuses_acceptable(tt, instances, acceptable_statuses):
256+
status_ = status(tt)
257+
return all([(status_[inst].get("STATUS") in acceptable_statuses) for inst in instances])
258+
259+
return utils.wait_event(
260+
timeout,
261+
are_all_statuses_acceptable,
262+
interval,
263+
tt_app.tt,
264+
instances,
265+
acceptable_statuses,
266+
)
267+
268+
254269
def post_start_base(tt_app):
255270
assert utils.wait_files(5, pid_files(tt_app, tt_app.running_instances))
256271

0 commit comments

Comments
 (0)