From ab434220d4f2713bde81f6630c8716e257a84103 Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:09:33 +0800 Subject: [PATCH 1/6] Test out if label is affecting the runner VM name --- tests/integration/test_runner_manager_openstack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index 63b7204b3..2893114cf 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -36,8 +36,8 @@ @pytest.fixture(scope="module", name="runner_label") -def runner_label(): - return f"test-{token_hex(6)}" +def runner_label(app_name: str): + return f"{app_name}-{token_hex(6)}" @pytest.fixture(scope="module", name="log_dir_base_path") From 424694ffe52f6be4bc098ad871106b59fdd7ca1a Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:09:45 +0800 Subject: [PATCH 2/6] Test out if label is affecting the runner VM name --- tests/integration/test_runner_manager_openstack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index 2893114cf..cbede4d61 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -37,7 +37,7 @@ @pytest.fixture(scope="module", name="runner_label") def runner_label(app_name: str): - return f"{app_name}-{token_hex(6)}" + return f"{app_name}-test-{token_hex(6)}" @pytest.fixture(scope="module", name="log_dir_base_path") From c5c74a6359b65d9d67d4da7b77b8266d56d81c0d Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:57:34 +0800 Subject: [PATCH 3/6] Testing a fix for the cleanup --- .../test_runner_manager_openstack.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index cbede4d61..cc352319e 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -7,7 +7,7 @@ import json from pathlib import Path from secrets import token_hex -from typing import Iterator +from typing import AsyncGenerator, Iterator import pytest import pytest_asyncio @@ -36,8 +36,8 @@ @pytest.fixture(scope="module", name="runner_label") -def runner_label(app_name: str): - return f"{app_name}-test-{token_hex(6)}" +def runner_label(): + return f"test-{token_hex(6)}" @pytest.fixture(scope="module", name="log_dir_base_path") @@ -96,7 +96,7 @@ async def openstack_runner_manager_fixture( proxy_config: ProxyConfig, runner_label: str, openstack_connection: OpenstackConnection, -) -> OpenStackRunnerManager: +) -> AsyncGenerator[OpenStackRunnerManager, None, None]: """Create OpenstackRunnerManager instance. The prefix args of OpenstackRunnerManager set to app_name to let openstack_connection_fixture @@ -124,7 +124,7 @@ async def openstack_runner_manager_fixture( ssh_debug_connections=None, repo_policy_compliance=None, ) - return OpenStackRunnerManager( + yield OpenStackRunnerManager( app_name, f"{app_name}-0", cloud_config, server_config, runner_config, service_config ) @@ -135,13 +135,13 @@ async def runner_manager_fixture( token: str, github_path: GitHubPath, log_dir_base_path: dict[str, Path], -) -> RunnerManager: +) -> AsyncGenerator[RunnerManager, None, None]: """Get RunnerManager instance. Import of log_dir_base_path to monkeypatch the runner logs path with tmp_path. """ config = RunnerManagerConfig(token, github_path) - return RunnerManager("test_runner", openstack_runner_manager, config) + yield RunnerManager("test_runner", openstack_runner_manager, config) @pytest_asyncio.fixture(scope="function", name="runner_manager_with_one_runner") @@ -263,6 +263,9 @@ async def test_runner_normal_idle_lifecycle( runner = openstack_instances[0] assert openstack_runner_manager._health_check(runner) + + # TODO: debug only + assert False, "Testing failure" # 3. runner_manager.cleanup() From bf8e809e7965c9393149b3ffddc9026dd4d6f3d1 Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:53:04 +0800 Subject: [PATCH 4/6] Fix typing --- tests/integration/test_runner_manager_openstack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index 88e6de944..6d4181130 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -105,7 +105,7 @@ async def openstack_runner_manager_fixture( proxy_config: ProxyConfig, runner_label: str, openstack_connection: OpenstackConnection, -) -> AsyncGenerator[OpenStackRunnerManager, None, None]: +) -> AsyncGenerator[OpenStackRunnerManager, None]: """Create OpenstackRunnerManager instance. The prefix args of OpenstackRunnerManager set to app_name to let openstack_connection_fixture @@ -144,7 +144,7 @@ async def runner_manager_fixture( token: str, github_path: GitHubPath, log_dir_base_path: dict[str, Path], -) -> AsyncGenerator[RunnerManager, None, None]: +) -> AsyncGenerator[RunnerManager, None]: """Get RunnerManager instance. Import of log_dir_base_path to monkeypatch the runner logs path with tmp_path. From 7993c119660a10d669be419353c2be86b1885401 Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:16:46 +0800 Subject: [PATCH 5/6] Remove debug --- tests/integration/test_runner_manager_openstack.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index 6d4181130..32abeec06 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -273,9 +273,6 @@ async def test_runner_normal_idle_lifecycle( assert openstack_runner_manager._health_check(runner) - # TODO: debug only - assert False, "Testing failure" - # 3. runner_manager.cleanup() runner_list = runner_manager.get_runners() From e839b00911fc476964e0fe77c6ce16b5fd282581 Mon Sep 17 00:00:00 2001 From: yhaliaw <43424755+yhaliaw@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:28:47 +0800 Subject: [PATCH 6/6] Fix formating --- tests/integration/test_runner_manager_openstack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_runner_manager_openstack.py b/tests/integration/test_runner_manager_openstack.py index 32abeec06..ba4d71b10 100644 --- a/tests/integration/test_runner_manager_openstack.py +++ b/tests/integration/test_runner_manager_openstack.py @@ -272,7 +272,7 @@ async def test_runner_normal_idle_lifecycle( runner = openstack_instances[0] assert openstack_runner_manager._health_check(runner) - + # 3. runner_manager.cleanup() runner_list = runner_manager.get_runners()