This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch v2-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-10-test by this push:
new b188b0f092 manually commiting cherry pick 6da1799 (#42983)
b188b0f092 is described below
commit b188b0f092330b5e6df214fb03aea0448782c5ee
Author: GPK <[email protected]>
AuthorDate: Mon Oct 14 11:24:52 2024 +0100
manually commiting cherry pick 6da1799 (#42983)
---
tests/cli/commands/_common_cli_classes.py | 10 ++++++++++
tests/cli/commands/test_internal_api_command.py | 4 +---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/tests/cli/commands/_common_cli_classes.py
b/tests/cli/commands/_common_cli_classes.py
index a5f78e9cfc..2ab07074bc 100644
--- a/tests/cli/commands/_common_cli_classes.py
+++ b/tests/cli/commands/_common_cli_classes.py
@@ -146,3 +146,13 @@ class _ComonCLIGunicornTestClass:
console.print(proc.as_dict(attrs=["pid", "name",
"cmdline"]))
pids.append(proc.pid)
return pids
+
+ def _terminate_multiple_process(self, pid_list):
+ process = []
+ for pid in pid_list:
+ proc = psutil.Process(pid)
+ proc.terminate()
+ process.append(proc)
+ gone, alive = psutil.wait_procs(process, timeout=120)
+ for p in alive:
+ p.kill()
diff --git a/tests/cli/commands/test_internal_api_command.py
b/tests/cli/commands/test_internal_api_command.py
index a1aaf2daca..5d230d4c20 100644
--- a/tests/cli/commands/test_internal_api_command.py
+++ b/tests/cli/commands/test_internal_api_command.py
@@ -144,9 +144,7 @@ class TestCliInternalAPI(_ComonCLIGunicornTestClass):
"[magenta]Terminating monitor process and expect "
"internal-api and gunicorn processes to terminate as well"
)
- proc = psutil.Process(pid_monitor)
- proc.terminate()
- assert proc.wait(120) in (0, None)
+ self._terminate_multiple_process([pid_internal_api, pid_monitor])
self._check_processes(ignore_running=False)
console.print("[magenta]All internal-api and gunicorn processes
are terminated.")
except Exception: