1
0
mirror of https://gitlab.isc.org/isc-projects/bind9.git synced 2025-04-19 20:42:22 +03:00
bind9/util/get-running-system-tests.py
Michal Nowak 35792b1700
Report hung system tests
At times, a problem might occur where a test is not responding,
especially in the CI, determining the specific test responsible can be
difficult. Fortunately, when running tests with the pytest runner,
pytest sets the PYTEST_CURRENT_TEST environment variable to the current
test nodeid and stage. Afterward, the variable can be examined to
identify the test that has stopped responding.

The monitoring script needs to be started in the background. Still, the
shell executor used for BSD and FIPS testing can't handle the background
process cleanly, and the script step will wait for the background
process for the entire duration of the background process (currently
3000 seconds). Therefore, run the monitoring script only when the Docker
executor is used where this is not a problem.
2023-10-05 14:57:26 +02:00

26 lines
817 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import psutil
for pid in psutil.pids():
try:
environ = psutil.Process(pid).environ()
if "PYTEST_CURRENT_TEST" in environ:
name = psutil.Process(pid).name()
print(
f'pytest process {name}/{pid} running: {environ["PYTEST_CURRENT_TEST"]}'
)
except (psutil.AccessDenied, psutil.NoSuchProcess):
pass