|
| 1 | +# Copyright 2024 Canonical Ltd. |
| 2 | +# See LICENSE file for licensing details. |
| 3 | + |
| 4 | +"""Test charms subordinated to MySQL charm.""" |
| 5 | + |
| 6 | +import asyncio |
| 7 | + |
| 8 | +import pytest |
| 9 | + |
| 10 | +from .relations.test_database import APPLICATION_APP_NAME, CLUSTER_NAME, DATABASE_APP_NAME, TIMEOUT |
| 11 | + |
| 12 | +UBUNTU_PRO_APP_NAME = "ubuntu-pro" |
| 13 | + |
| 14 | + |
| 15 | +@pytest.mark.group(1) |
| 16 | +async def test_ubuntu_pro(ops_test, mysql_charm_series, github_secrets): |
| 17 | + db_charm = await ops_test.build_charm(".") |
| 18 | + await asyncio.gather( |
| 19 | + ops_test.model.deploy( |
| 20 | + db_charm, |
| 21 | + application_name=DATABASE_APP_NAME, |
| 22 | + config={"cluster-name": CLUSTER_NAME, "profile": "testing"}, |
| 23 | + series=mysql_charm_series, |
| 24 | + ), |
| 25 | + ops_test.model.deploy( |
| 26 | + APPLICATION_APP_NAME, |
| 27 | + application_name=APPLICATION_APP_NAME, |
| 28 | + channel="latest/edge", |
| 29 | + ), |
| 30 | + ops_test.model.deploy( |
| 31 | + UBUNTU_PRO_APP_NAME, |
| 32 | + application_name=UBUNTU_PRO_APP_NAME, |
| 33 | + channel="latest/edge", |
| 34 | + config={"token": github_secrets["UBUNTU_PRO_TOKEN"]}, |
| 35 | + ), |
| 36 | + ) |
| 37 | + await ops_test.model.relate( |
| 38 | + f"{DATABASE_APP_NAME}:database", f"{APPLICATION_APP_NAME}:database" |
| 39 | + ) |
| 40 | + await ops_test.model.relate(f"{DATABASE_APP_NAME}", f"{UBUNTU_PRO_APP_NAME}") |
| 41 | + async with ops_test.fast_forward("60s"): |
| 42 | + await ops_test.model.wait_for_idle( |
| 43 | + apps=[DATABASE_APP_NAME, APPLICATION_APP_NAME, UBUNTU_PRO_APP_NAME], |
| 44 | + status="active", |
| 45 | + raise_on_blocked=True, |
| 46 | + timeout=TIMEOUT, |
| 47 | + ) |
0 commit comments