66import json
77from typing import AsyncIterator
88
9+ import jubilant
910import pytest
1011import pytest_asyncio
1112from github .Branch import Branch
1213from github .Repository import Repository
1314from github_runner_manager .manager .vm_manager import PostJobStatus
1415from juju .application import Application
15- from juju .model import Model
1616
1717from charm_state import BASE_VIRTUAL_MACHINES_CONFIG_NAME
1818from tests .integration .helpers .charm_metrics import (
2929
3030
3131@pytest_asyncio .fixture (scope = "function" , name = "app" )
32- async def app_fixture (model : Model , app_for_metric : Application ) -> AsyncIterator [Application ]:
32+ async def app_fixture (app_for_metric : Application ) -> AsyncIterator [Application ]:
3333 """Setup and teardown the charm after each test.
3434
3535 Clear the metrics log before each test.
@@ -44,7 +44,7 @@ async def app_fixture(model: Model, app_for_metric: Application) -> AsyncIterato
4444@pytest .mark .asyncio
4545@pytest .mark .abort_on_fail
4646async def test_charm_issues_runner_installed_metric (
47- app : Application , instance_helper : OpenStackInstanceHelper
47+ juju : jubilant . Juju , app : Application , instance_helper : OpenStackInstanceHelper
4848):
4949 """
5050 arrange: A working charm deployment.
@@ -54,7 +54,7 @@ async def test_charm_issues_runner_installed_metric(
5454 await instance_helper .ensure_charm_has_runner (app )
5555
5656 # Set the number of virtual machines to 0 to speedup reconciliation
57- await app . set_config ( {BASE_VIRTUAL_MACHINES_CONFIG_NAME : "0" })
57+ juju . config ( app . name , values = {BASE_VIRTUAL_MACHINES_CONFIG_NAME : "0" })
5858 await wait_for_reconcile (app = app )
5959
6060 metrics_log = await get_metrics_log (app .units [0 ])
@@ -73,6 +73,7 @@ async def test_charm_issues_runner_installed_metric(
7373@pytest .mark .asyncio
7474@pytest .mark .abort_on_fail
7575async def test_charm_issues_metrics_after_reconciliation (
76+ juju : jubilant .Juju ,
7677 app : Application ,
7778 github_repository : Repository ,
7879 test_github_branch : Branch ,
@@ -98,7 +99,7 @@ async def test_charm_issues_metrics_after_reconciliation(
9899 )
99100
100101 # Set the number of virtual machines to 0 to speedup reconciliation
101- await app . set_config ( {BASE_VIRTUAL_MACHINES_CONFIG_NAME : "0" })
102+ juju . config ( app . name , values = {BASE_VIRTUAL_MACHINES_CONFIG_NAME : "0" })
102103 await wait_for_reconcile (app = app )
103104
104105 await assert_events_after_reconciliation (
0 commit comments