mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Merge pull request #32931 from azat/integration-cleanup_environment-fix
tests/integration/cleanup_environment: fix obtaining PYTEST_CLEANUP_CONTAINERS
This commit is contained in:
commit
a743d79980
@ -8,12 +8,12 @@ from helpers.network import _NetworkManager
|
||||
@pytest.fixture(autouse=True, scope="session")
|
||||
def cleanup_environment():
|
||||
try:
|
||||
if int(os.environ.get("PYTEST_CLEANUP_CONTAINERS")) == 1:
|
||||
if int(os.environ.get("PYTEST_CLEANUP_CONTAINERS", 0)) == 1:
|
||||
logging.debug(f"Cleaning all iptables rules")
|
||||
_NetworkManager.clean_all_user_iptables_rules()
|
||||
result = run_and_check(['docker ps | wc -l'], shell=True)
|
||||
if int(result) > 1:
|
||||
if int(os.environ.get("PYTEST_CLEANUP_CONTAINERS")) != 1:
|
||||
if int(os.environ.get("PYTEST_CLEANUP_CONTAINERS", 0)) != 1:
|
||||
logging.warning(f"Docker containters({int(result)}) are running before tests run. They can be left from previous pytest run and cause test failures.\n"\
|
||||
"You can set env PYTEST_CLEANUP_CONTAINERS=1 or use runner with --cleanup-containers argument to enable automatic containers cleanup.")
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user