test: manage runners at every scope, rerun and delete a completed run, fail when the runner is required
This commit is contained in:
1 parent
9e51f72ec9
commit
7dc749d7cd
3 files changed
+161
-8
No files matched your search
@@ -35,6 +35,25 @@ _HERE = Path(__file__).parent.resolve()
|
||||
ENABLE_ENV = "AEGIS_INTEGRATION"
|
||||
|
||||
|
||||
REQUIRE_RUNNER_ENV = "AEGIS_IT_REQUIRE_RUNNER"
|
||||
|
||||
|
||||
def runner_required() -> bool:
|
||||
"""True when a runner that cannot start must fail the test instead of xfailing it.
|
||||
|
||||
Set by the CI job (``AEGIS_IT_REQUIRE_RUNNER=1``) and implied by ``CI``: a pipeline that
|
||||
silently skips the Actions scenario would hide a broken runner setup.
|
||||
"""
|
||||
return os.environ.get(REQUIRE_RUNNER_ENV) == "1" or bool(os.environ.get("CI"))
|
||||
|
||||
|
||||
def runner_unavailable(reason: str) -> None:
|
||||
"""Report that the act_runner could not start or come online (fails or xfails)."""
|
||||
if runner_required():
|
||||
pytest.fail(f"act_runner unavailable: {reason}", pytrace=False)
|
||||
pytest.xfail(reason)
|
||||
|
||||
|
||||
def integration_enabled() -> bool:
|
||||
"""Return True when the opt-in env var is set."""
|
||||
return os.environ.get(ENABLE_ENV) == "1"
|
||||
|
||||
Reference in new issue
Block a user