Skip to content
Closed
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
27 changes: 14 additions & 13 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def app_no_runner(
basic_app: str,
) -> Iterator[str]:
"""Application with no runner."""
juju.config(basic_app, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"})
juju.config(basic_app, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"}, log=False)
juju.wait(
lambda status: jubilant.all_active(status, basic_app),
timeout=20 * 60,
Expand Down Expand Up @@ -581,8 +581,7 @@ def image_builder_fixture(
series = dep_ctx.series

any_charm_src_overwrite = {
"any_charm.py": textwrap.dedent(
f"""\
"any_charm.py": textwrap.dedent(f"""\
from any_charm_base import AnyCharmBase

class AnyCharm(AnyCharmBase):
Expand All @@ -595,8 +594,7 @@ def _image_relation_changed(self, event):
# Provide mock image relation data
event.relation.data[self.unit]['id'] = '{openstack_config.test_image_id}'
event.relation.data[self.unit]['tags'] = '{series}, amd64'
"""
),
"""),
}
logging.info(
"Deploying fake image builder via any-charm for image ID %s",
Expand All @@ -607,6 +605,7 @@ def _image_relation_changed(self, event):
app=image_builder_app_name,
channel="latest/beta",
config={"src-overwrite": json.dumps(any_charm_src_overwrite)},
log=False,
)
yield image_builder_app_name

Expand Down Expand Up @@ -680,8 +679,8 @@ def app_scheduled_events_fixture(
app_openstack_runner: str,
) -> str:
"""Application to check scheduled events."""
juju.config(app_openstack_runner, values={"reconcile-interval": "8"})
juju.config(app_openstack_runner, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"})
juju.config(app_openstack_runner, values={"reconcile-interval": "8"}, log=False)
juju.config(app_openstack_runner, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"}, log=False)
juju.wait(
lambda status: jubilant.all_active(status, app_openstack_runner),
timeout=20 * 60,
Expand Down Expand Up @@ -730,7 +729,7 @@ def app_no_wait_fixture(
base=deployment_context.base,
wait_idle=False,
)
juju.config(deployed_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"})
juju.config(deployed_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"}, log=False)
return deployed_name


Expand All @@ -744,6 +743,7 @@ def tmate_ssh_server_app_fixture(juju: jubilant.Juju) -> str:
# 2025-11-26: Set deployment type to virtual-machine due to bug with snapd. See:
# https://github.com/canonical/snapd/pull/16131
constraints={"virt-type": "virtual-machine"},
log=False,
)
return tmate_app_name

Expand Down Expand Up @@ -845,7 +845,9 @@ def app_with_forked_repo(
Test should ensure it returns with the application in a good state and has
one runner.
"""
juju.config(basic_app, values={PATH_CONFIG_NAME: forked_github_repository.full_name})
juju.config(
basic_app, values={PATH_CONFIG_NAME: forked_github_repository.full_name}, log=False
)

return basic_app

Expand Down Expand Up @@ -922,8 +924,7 @@ def mock_planner_app(juju: jubilant.Juju, planner_token_secret: str) -> Iterator
planner_name = "planner"

any_charm_src_overwrite = {
"any_charm.py": textwrap.dedent(
f"""\
"any_charm.py": textwrap.dedent(f"""\
from any_charm_base import AnyCharmBase

class AnyCharm(AnyCharmBase):
Expand All @@ -937,15 +938,15 @@ def __init__(self, *args, **kwargs):
def _on_planner_relation_changed(self, event):
event.relation.data[self.app]["endpoint"] = "http://mock:8080"
event.relation.data[self.app]["token"] = "{planner_token_secret}"
"""
),
"""),
}

juju.deploy(
"any-charm",
app=planner_name,
channel="latest/beta",
config={"src-overwrite": json.dumps(any_charm_src_overwrite)},
log=False,
)

juju.wait(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run_in_unit(
Tuple of return code, stdout and stderr.
"""
try:
task = juju.exec(command, unit=unit_name, wait=timeout)
task = juju.exec(command, unit=unit_name, wait=timeout, log=False)
code, stdout, stderr = task.return_code, task.stdout, task.stderr
except jubilant.TaskError as e:
code, stdout, stderr = e.task.return_code, e.task.stdout, e.task.stderr
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/helpers/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ def set_app_runner_amount(self, app_name: str, num_runners: int) -> None:
app_name: The GitHub Runner Charm app name to create the runner for.
num_runners: The number of runners.
"""
self.juju.config(app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: f"{num_runners}"})
self.juju.config(
app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: f"{num_runners}"}, log=False
)
if num_runners == 0:
return
wait_for_runner_ready(self.juju, app_name, num_runners=num_runners)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm_fork_path_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_path_config_change(
logger.info("Ensure there is a runner (this calls reconcile)")
instance_helper.ensure_charm_has_runner(app_with_forked_repo)

juju.config(app_with_forked_repo, values={PATH_CONFIG_NAME: github_config.path})
juju.config(app_with_forked_repo, values={PATH_CONFIG_NAME: github_config.path}, log=False)

logger.info("Reconciling (again)")
wait_for_runner_ready(juju, app_with_forked_repo)
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_charm_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def app_fixture(
"""
yield basic_app

juju.config(basic_app, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"})
juju.config(basic_app, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"}, log=False)

unit_name = f"{basic_app}/0"

Expand Down Expand Up @@ -172,6 +172,7 @@ def test_custom_pre_job_script(
logger -s "SSH config: $(cat ~/.ssh/config)"
""",
},
log=False,
)
wait_for_runner_ready(juju, app)

Expand Down
15 changes: 6 additions & 9 deletions tests/integration/test_prometheus_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def k8s_juju_fixture(request: pytest.FixtureRequest) -> Generator[jubilant.Juju,
@pytest.fixture(scope="module", name="prometheus_app")
def prometheus_app_fixture(k8s_juju: jubilant.Juju) -> AppStatus:
"""Deploy prometheus charm."""
k8s_juju.deploy("prometheus-k8s", channel="1/stable")
k8s_juju.deploy("prometheus-k8s", channel="1/stable", log=False)
k8s_juju.wait(lambda status: jubilant.all_active(status, "prometheus-k8s"))
assert k8s_juju.model is not None
k8s_juju_model_name = k8s_juju.model.split(":", 1)[1]
Expand All @@ -58,7 +58,7 @@ def prometheus_app_fixture(k8s_juju: jubilant.Juju) -> AppStatus:
@pytest.fixture(scope="module", name="grafana_app")
def grafana_app_fixture(k8s_juju: jubilant.Juju, prometheus_app: AppStatus) -> AppStatus:
"""Deploy grafana charm."""
k8s_juju.deploy("grafana-k8s", channel="1/stable")
k8s_juju.deploy("grafana-k8s", channel="1/stable", log=False)
k8s_juju.integrate("grafana-k8s:grafana-source", f"{prometheus_app.charm_name}:grafana-source")
k8s_juju.wait(lambda status: jubilant.all_active(status, "grafana-k8s", "prometheus-k8s"))
assert k8s_juju.model is not None
Expand All @@ -76,7 +76,7 @@ def traefik_ingress_fixture(
k8s_juju: jubilant.Juju, prometheus_app: AppStatus, grafana_app: AppStatus
) -> None:
"""Ingress for cross controller communication."""
k8s_juju.deploy("traefik-k8s", channel="latest/stable")
k8s_juju.deploy("traefik-k8s", channel="latest/stable", log=False)
k8s_juju.integrate("traefik-k8s", f"{prometheus_app.charm_name}:ingress")
k8s_juju.integrate("traefik-k8s", f"{grafana_app.charm_name}:ingress")

Expand All @@ -94,10 +94,7 @@ def openstack_app_cos_agent_fixture(juju: jubilant.Juju, app_openstack_runner: s
"""Deploy cos-agent subordinate charm. Return the app name as a string."""
app_name = app_openstack_runner
juju.deploy(
COS_AGENT_CHARM,
channel="2/candidate",
base="ubuntu@22.04",
revision=149,
COS_AGENT_CHARM, channel="2/candidate", base="ubuntu@22.04", revision=149, log=False
)
juju.integrate(app_name, COS_AGENT_CHARM)
juju.wait(lambda status: jubilant.all_agents_idle(status, app_name, COS_AGENT_CHARM))
Expand Down Expand Up @@ -144,7 +141,7 @@ def test_prometheus_metrics(
grafana_ip=grafana_ip, grafana_password=grafana_password
)

juju.config(app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"})
juju.config(app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "1"}, log=False)
_wait_for_runner_ready(juju, app_name)

dispatch_workflow(
Expand All @@ -156,7 +153,7 @@ def test_prometheus_metrics(
dispatch_input={"runner": app_name},
)

juju.config(app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"})
juju.config(app_name, values={BASE_VIRTUAL_MACHINES_CONFIG_NAME: "0"}, log=False)
_wait_for_no_runners(juju, app_name)

prometheus_ip = prometheus_app.address
Expand Down
Loading