Skip to content

Commit

Permalink
test: add a bit more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dmyger committed Oct 1, 2024
1 parent eec6c5a commit c7c5712
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/integration/connect/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ def kill_remain_processes_wrapper(tt_cmd):
)
response = tt_proc.communicate()[0]
procs = [psutil.Process(int(pid)) for pid in response.split()]

kill_procs(procs)
if len(procs) > 0:
print(f"Kill procs: {list(p.cmdline() for p in procs)}")
kill_procs(procs)
assert len(procs) == 0, "Use `stop_app()` to terminate running instance"


Expand Down Expand Up @@ -61,7 +62,8 @@ def start_app(tt_cmd, tmpdir_with_cfg, app_name, start_binary_port=False):

def stop_app(tt_cmd, tmpdir, app_name):
stop_cmd = [tt_cmd, "--no-prompt", "stop", app_name]
run_command_and_get_output(stop_cmd, cwd=tmpdir)
code, output = run_command_and_get_output(stop_cmd, cwd=tmpdir)
print(f"Stop app: {stop_cmd} -> code={code}, output='{output}'")


def try_execute_on_instance(tt_cmd, tmpdir, instance,
Expand Down Expand Up @@ -93,6 +95,7 @@ def try_execute_on_instance(tt_cmd, tmpdir, instance,
text=True,
env=env,
)
# print(f"Command: {connect_cmd} << {stdin} -> returncode={instance_process.returncode}")
return instance_process.returncode == 0, instance_process.stdout


Expand Down Expand Up @@ -295,12 +298,14 @@ def test_connect_and_get_commands_outputs(tt_cmd, tmpdir_with_cfg):
assert file != ""

for key, value in commands.items():
ret, output = try_execute_on_instance(tt_cmd, tmpdir, "localhost:3013", stdin=key)
print(output)
assert ret
success, output = try_execute_on_instance(tt_cmd, tmpdir, "localhost:3013", stdin=key)
# print(f"success={success}: {output}")
assert success

assert output == value
print("Done all commands.")
finally:
print("--- Finally ---")
stop_app(tt_cmd, tmpdir, "test_app")


Expand Down

0 comments on commit c7c5712

Please sign in to comment.