Skip to content

Commit

Permalink
test_start_interactive uses pipe_wait_all
Browse files Browse the repository at this point in the history
  • Loading branch information
dmyger committed Oct 21, 2024
1 parent 1dace26 commit a0d054e
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions test/integration/running/test_running.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
import yaml
from retry import retry

from utils import (config_name, control_socket, extract_status, initial_snap,
initial_xlog, kill_child_process, lib_path, log_file,
log_path, pid_file, run_command_and_get_output, run_path,
wait_file, wait_for_lines_in_output, wait_instance_start,
wait_instance_stop, wait_string_in_file)
from utils import (ProcessTextPipe, config_name, control_socket,
extract_status, initial_snap, initial_xlog,
kill_child_process, lib_path, log_file, log_path, pid_file,
pipe_wait_all, run_command_and_get_output, run_path,
wait_file, wait_instance_start, wait_instance_stop,
wait_string_in_file)


def test_running_base_functionality(tt_cmd, tmpdir_with_cfg):
Expand Down Expand Up @@ -935,35 +936,21 @@ def test_start_interactive(tt_cmd, tmp_path):
tmp_path /= "multi_inst_app"
shutil.copytree(test_app_path_src, tmp_path)

start_cmd = [tt_cmd, "start", "-i"]
instance_process = subprocess.Popen(
start_cmd,
cwd=tmp_path,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
text=True
)
try:
wait_for_lines_in_output(instance_process.stdout, [
with ProcessTextPipe((tt_cmd, "start", "-i"), tmp_path) as instance_process:
pipe_wait_all(
instance_process,
"multi_inst_app:router custom init file...",
"multi_inst_app:router multi_inst_app:router",
"multi_inst_app:master multi_inst_app:master",
"multi_inst_app:replica multi_inst_app:replica",
"multi_inst_app:stateboard unknown instance",
])

)
instance_process.send_signal(signal.SIGTERM)

wait_for_lines_in_output(instance_process.stdout, [
pipe_wait_all(
instance_process,
"multi_inst_app:router stopped",
"multi_inst_app:master stopped",
"multi_inst_app:replica stopped",
"multi_inst_app:stateboard stopped",
])

# Make sure no log dir created.
assert not (tmp_path / "var" / "log").exists()

finally:
run_command_and_get_output([tt_cmd, "stop", "--yes"], cwd=tmp_path)
assert instance_process.wait(5) == 0
)
assert instance_process.Stop(tt_cmd, "stop", "--yes", timeout=10) == 0

0 comments on commit a0d054e

Please sign in to comment.