From ba9c38f761d6c98b9bf60531a802030ebbf751ad Mon Sep 17 00:00:00 2001 From: Florent 'Skia' Jacquet Date: Thu, 7 May 2026 13:22:15 +0200 Subject: [PATCH 1/3] charm: make CI faster --- charm/tests/conftest.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/charm/tests/conftest.py b/charm/tests/conftest.py index 1f6c327..ec9cb88 100644 --- a/charm/tests/conftest.py +++ b/charm/tests/conftest.py @@ -58,15 +58,14 @@ def services(juju: jubilant.Juju) -> None: ) juju.deploy("rabbitmq-server") juju.deploy(charm="ubuntu", app="swift") - - -@pytest.fixture -def cassandra(juju: jubilant.Juju, services) -> dict[str, str]: juju.wait( - lambda status: jubilant.all_active(status, "cassandra"), + lambda status: jubilant.all_active(status, "cassandra", "rabbitmq-server", "swift"), timeout=900, ) + +@pytest.fixture +def cassandra(juju: jubilant.Juju, services) -> dict[str, str]: # Get Cassandra credentials task = juju.exec("cat", "/home/ubuntu/.cassandra/cqlshrc", unit="cassandra/0") logger.info("Cassandra config: " + task.stdout) @@ -81,10 +80,6 @@ def cassandra(juju: jubilant.Juju, services) -> dict[str, str]: @pytest.fixture def amqp(juju: jubilant.Juju, services) -> dict[str, str]: - juju.wait( - lambda status: jubilant.all_active(status, "rabbitmq-server"), - timeout=600, - ) amqp_host = juju.status().get_units("rabbitmq-server")["rabbitmq-server/0"].public_address logger.info("RabbitMQ address: " + amqp_host) @@ -118,10 +113,6 @@ def amqp(juju: jubilant.Juju, services) -> dict[str, str]: @pytest.fixture def swift(juju: jubilant.Juju, services) -> dict[str, str]: - juju.wait( - lambda status: jubilant.all_active(status, "swift"), - timeout=600, - ) swift_host = juju.status().get_units("swift")["swift/0"].public_address logger.info("swift address: " + swift_host) From 8bc56962a1ebbcd7b73de06d983c9e20cab506b5 Mon Sep 17 00:00:00 2001 From: Florent 'Skia' Jacquet Date: Thu, 7 May 2026 13:31:58 +0200 Subject: [PATCH 2/3] charm: make CI even faster --- charm/tests/conftest.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/charm/tests/conftest.py b/charm/tests/conftest.py index ec9cb88..4c33309 100644 --- a/charm/tests/conftest.py +++ b/charm/tests/conftest.py @@ -58,6 +58,29 @@ def services(juju: jubilant.Juju) -> None: ) juju.deploy("rabbitmq-server") juju.deploy(charm="ubuntu", app="swift") + + # Swift is ready first + juju.wait(lambda status: jubilant.all_active(status, "swift"), timeout=600) + juju.exec("sudo", "apt-get", "install", "-Uy", "docker.io", unit="swift/0") + juju.exec( + "docker", + "run", + "--name", + "swift", + "--network", + "host", + "--rm", + "-d", + "docker.io/openstackswift/saio", + unit="swift/0", + ) + + # Then comes RabbitMQ + juju.wait(lambda status: jubilant.all_active(status, "rabbitmq-server"), timeout=600) + # Useful to push arbitrary messages in test cases. + juju.exec("sudo", "apt-get", "install", "-y", "amqp-tools", unit="rabbitmq-server/0") + + # Make sure everything is ready juju.wait( lambda status: jubilant.all_active(status, "cassandra", "rabbitmq-server", "swift"), timeout=900, @@ -83,9 +106,6 @@ def amqp(juju: jubilant.Juju, services) -> dict[str, str]: amqp_host = juju.status().get_units("rabbitmq-server")["rabbitmq-server/0"].public_address logger.info("RabbitMQ address: " + amqp_host) - # Useful to push arbitrary messages in test cases. - juju.exec("sudo", "apt-get", "install", "-y", "amqp-tools", unit="rabbitmq-server/0") - # Set up rabbitmq test user juju.exec("sudo", "rabbitmqctl", "add_user", "test", "test", unit="rabbitmq-server/0") juju.exec( @@ -116,19 +136,6 @@ def swift(juju: jubilant.Juju, services) -> dict[str, str]: swift_host = juju.status().get_units("swift")["swift/0"].public_address logger.info("swift address: " + swift_host) - juju.exec("sudo", "apt-get", "install", "-Uy", "docker.io", unit="swift/0") - juju.exec( - "docker", - "run", - "--name", - "swift", - "--network", - "host", - "--rm", - "-d", - "docker.io/openstackswift/saio", - unit="swift/0", - ) return { "auth_url": f"http://{swift_host}:8080/auth/v1.0", "username": "test:tester", From 64a67e4f8d59c1b18330096b89baddc82b848183 Mon Sep 17 00:00:00 2001 From: Florent 'Skia' Jacquet Date: Thu, 7 May 2026 13:53:53 +0200 Subject: [PATCH 3/3] charm: make CI even more faster --- charm/tests/integration/test_daisy.py | 9 ++++++--- charm/tests/integration/test_errors.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/charm/tests/integration/test_daisy.py b/charm/tests/integration/test_daisy.py index dffc1e7..619d867 100644 --- a/charm/tests/integration/test_daisy.py +++ b/charm/tests/integration/test_daisy.py @@ -21,6 +21,10 @@ def test_deploy( error_tracker_config: str, charm_path: str, ): + """ + Deploy everything at once, but don't integrate anything. This is just to + speed up CI by parallelizing deployment. + """ juju.deploy( charm=charm_path, app="daisy", @@ -33,6 +37,8 @@ def test_deploy( "enable_errors": False, }, ) + juju.deploy(HAPROXY, channel="2.8/edge", config={"external-hostname": "haproxy.internal"}) + juju.deploy(SSC, channel="1/edge") juju.wait(lambda status: jubilant.all_active(status, "daisy"), timeout=600) @@ -40,9 +46,6 @@ def test_deploy( def test_http(juju: jubilant.Juju): - juju.deploy(HAPROXY, channel="2.8/edge", config={"external-hostname": "haproxy.internal"}) - juju.deploy(SSC, channel="1/edge") - juju.integrate(HAPROXY + ":certificates", SSC + ":certificates") juju.integrate("daisy:route_daisy", HAPROXY) juju.wait(lambda status: jubilant.all_active(status, HAPROXY, SSC), timeout=1800) diff --git a/charm/tests/integration/test_errors.py b/charm/tests/integration/test_errors.py index ec97c56..aa90b73 100644 --- a/charm/tests/integration/test_errors.py +++ b/charm/tests/integration/test_errors.py @@ -21,6 +21,10 @@ def test_deploy( error_tracker_config: str, charm_path: str, ): + """ + Deploy everything at once, but don't integrate anything. This is just to + speed up CI by parallelizing deployment. + """ juju.deploy( charm=charm_path, app="errors", @@ -33,6 +37,8 @@ def test_deploy( "enable_errors": True, }, ) + juju.deploy(HAPROXY, channel="2.8/edge", config={"external-hostname": "haproxy.internal"}) + juju.deploy(SSC, channel="1/edge") juju.wait(lambda status: jubilant.all_active(status, "errors"), timeout=600) @@ -40,9 +46,6 @@ def test_deploy( def test_http(juju: jubilant.Juju): - juju.deploy(HAPROXY, channel="2.8/edge", config={"external-hostname": "haproxy.internal"}) - juju.deploy(SSC, channel="1/edge") - juju.integrate(HAPROXY + ":certificates", SSC + ":certificates") juju.integrate("errors:route_errors", HAPROXY) juju.wait(lambda status: jubilant.all_active(status, HAPROXY, SSC), timeout=1800)