Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/gha_runner/clouddeployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ def __post_init__(self):
# We need to create runner tokens for use by the provider
runner_tokens = self.gh.create_runner_tokens(self.count)
self.cloud_params["gh_runner_tokens"] = runner_tokens
architecture = self.cloud_params.get("arch", "x64")
release = self.gh.get_latest_runner_release(
platform="linux", architecture="x64"
platform="linux", architecture=architecture
)
self.cloud_params["runner_release"] = release
self.provider = self.provider_type(**self.cloud_params)
Expand Down
11 changes: 8 additions & 3 deletions tests/test_clouddeployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_instance_mapping(self):
def wait_until_removed(self, ids, **kwargs):
pass


class MockFailableWaitStop(StopCloudInstance):
def __init__(self):
self.instances = {"i-123": "runner-1"}
Expand Down Expand Up @@ -73,7 +74,9 @@ def deploy_instance(gh_mock):
def test_deploy_instance_creation(deploy_instance, gh_mock):
assert isinstance(deploy_instance.provider, MockStartCloudInstance)
gh_mock.create_runner_tokens.assert_called_once_with(1)
gh_mock.get_latest_runner_release.assert_called_once()
gh_mock.get_latest_runner_release.assert_called_once_with(
platform="linux", architecture="x64"
)


def test_deploy_instance_start_runners(deploy_instance, gh_mock):
Expand Down Expand Up @@ -127,17 +130,19 @@ def test_teardown_instance_failure(gh_mock, capsys):
teardown.stop_runner_instances()
captured = capsys.readouterr()
catpured_output = captured.out
expected_output = ["Shutting down...",
expected_output = [
"Shutting down...",
"Removing GitHub Actions Runner",
"Removing runner runner-1",
"::warning title=Failed to remove runner::Testing",
"Removing instances...",
"Waiting for instance to be removed...",
"Instances removed!"
"Instances removed!",
]
actual_output = catpured_output.strip().split("\n")
assert actual_output == expected_output


def test_teardown_instance_failed_wait(gh_mock, capsys):
with pytest.raises(SystemExit) as exit_info:
teardown = TeardownInstance(
Expand Down