Skip to content

Commit

Permalink
Refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
yhaliaw committed Nov 30, 2023
1 parent abd4954 commit f1b6ba0
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/integration/test_charm_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
)
from tests.status_name import ACTIVE_STATUS_NAME

TEST_WORKFLOW_NAME = "Workflow Dispatch Tests"
FAILURE_TEST_WORKFLOW_NAME = "Workflow Dispatch Failure Tests 2a34f8b1-41e4-4bcb-9bbf-7a74e6c482f7"
TEST_WORKFLOW_NAMES = [
"Workflow Dispatch Tests",
"Workflow Dispatch Failure Tests 2a34f8b1-41e4-4bcb-9bbf-7a74e6c482f7",
]


@pytest_asyncio.fixture(scope="module", name="app_integrated")
Expand Down Expand Up @@ -222,19 +224,13 @@ async def _assert_events_after_reconciliation(
for metric_log in log_lines:
if metric_log.get("event") == "runner_start":
assert metric_log.get("flavor") == app.name
assert (
metric_log.get("workflow") == TEST_WORKFLOW_NAME
or metric_log.get("workflow") == FAILURE_TEST_WORKFLOW_NAME
)
assert metric_log.get("workflow") in TEST_WORKFLOW_NAMES
assert metric_log.get("repo") == github_repository.full_name
assert metric_log.get("github_event") == "workflow_dispatch"
assert metric_log.get("idle") >= 0
if metric_log.get("event") == "runner_stop":
assert metric_log.get("flavor") == app.name
assert (
metric_log.get("workflow") == TEST_WORKFLOW_NAME
or metric_log.get("workflow") == FAILURE_TEST_WORKFLOW_NAME
)
assert metric_log.get("workflow") in TEST_WORKFLOW_NAMES
assert metric_log.get("repo") == github_repository.full_name
assert metric_log.get("github_event") == "workflow_dispatch"
assert metric_log.get("status") == post_job_status
Expand Down

0 comments on commit f1b6ba0

Please sign in to comment.