From 45d27fcbabdc93f1e6f7971e48c523551df26271 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 16 Jul 2026 14:27:14 -0400 Subject: [PATCH 1/5] feat: Juju v4 support in solution tests --- .github/workflows/_integration.yml | 4 +-- .../cos/juju_4/test_upgrade_cos_juju_4.py | 33 +++++++++++++++++++ .../juju_4/test_upgrade_cos_lite_juju_4.py | 20 +++++++++++ tests/integration/helpers.py | 2 +- 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 tests/integration/cos/juju_4/test_upgrade_cos_juju_4.py create mode 100644 tests/integration/cos_lite/juju_4/test_upgrade_cos_lite_juju_4.py diff --git a/.github/workflows/_integration.yml b/.github/workflows/_integration.yml index bfb66ee2..5719becd 100644 --- a/.github/workflows/_integration.yml +++ b/.github/workflows/_integration.yml @@ -41,10 +41,8 @@ jobs: juju-channel: ["3.6/stable"] scenario: ["tls_full", "tls_external", "tls_internal", "tls_none"] include: - - juju-channel: "4.0/beta" - scenario: "tls_full" - juju-channel: "4.1/beta" - scenario: "tls_full" + scenario: "juju_4" steps: - name: Checkout uses: actions/checkout@v4 diff --git a/tests/integration/cos/juju_4/test_upgrade_cos_juju_4.py b/tests/integration/cos/juju_4/test_upgrade_cos_juju_4.py new file mode 100644 index 00000000..00feca1a --- /dev/null +++ b/tests/integration/cos/juju_4/test_upgrade_cos_juju_4.py @@ -0,0 +1,33 @@ +"""Test the deployment of COS in full TLS mode for the current track. + +Any pytest file within this parent directory will be run against Juju v4.""" + +import os +from pathlib import Path + +import jubilant +from helpers import generic_assertions, no_errors_in_otelcol_logs + +TF_FILE = Path(__file__).parent.parent.resolve() / "tls_full/track-dev.tf" +S3_ENDPOINT = { + "s3_endpoint": os.getenv("S3_ENDPOINT"), + "s3_secret_key": os.getenv("S3_SECRET_KEY"), + "s3_access_key": os.getenv("S3_ACCESS_KEY"), +} + + +def test_envvars(): + assert all(S3_ENDPOINT.values()), ( + f"export the following env vars (upper case) before running this test: {S3_ENDPOINT.keys()}" + ) + + +def test_deploy_from_track( + tmp_path, tf_manager, ca_model: jubilant.Juju, cos_model: jubilant.Juju +): + # GIVEN a module deployed with full TLS configuration, providing the most coverage of the TLS + # configuration options + tf_manager.init(TF_FILE) + tf_manager.apply(ca_model=ca_model.model, cos_model=cos_model.model, **S3_ENDPOINT) + generic_assertions(cos_model, ca_model, tmp_path) + no_errors_in_otelcol_logs(cos_model) diff --git a/tests/integration/cos_lite/juju_4/test_upgrade_cos_lite_juju_4.py b/tests/integration/cos_lite/juju_4/test_upgrade_cos_lite_juju_4.py new file mode 100644 index 00000000..38380a49 --- /dev/null +++ b/tests/integration/cos_lite/juju_4/test_upgrade_cos_lite_juju_4.py @@ -0,0 +1,20 @@ +"""Test the deployment of COS in full TLS mode for the current track. + +Any pytest file within this parent directory will be run against Juju v4.""" + +from pathlib import Path + +import jubilant +from helpers import generic_assertions + +TF_FILE = Path(__file__).parent.parent.resolve() / "tls_full/track-dev.tf" + + +def test_deploy_from_track( + tmp_path, tf_manager, ca_model: jubilant.Juju, cos_model: jubilant.Juju +): + # GIVEN a module deployed with full TLS configuration, providing the most coverage of the TLS + # configuration options + tf_manager.init(TF_FILE) + tf_manager.apply(ca_model=ca_model.model, cos_model=cos_model.model) + generic_assertions(cos_model, ca_model, tmp_path) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 389c1052..bdb9a917 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -99,7 +99,7 @@ def get_tls_context( # Obtain certificate from external-ca cert_path = temp_path / "ca.pem" - task = juju.run(f"{ca_name}/0", "get-ca-certificate", {"format": "json"}) + task = juju.run(f"{ca_name}/0", "get-ca-certificate") cert = task.results.get("ca-certificate") cert_path.write_text(cert) From 1b00666786bebaef6e1be3cbfdb2081030a74ce8 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 16 Jul 2026 14:28:59 -0400 Subject: [PATCH 2/5] chore --- .github/workflows/terraform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 95c8cd15..889ef7c2 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -94,7 +94,7 @@ jobs: name: COS Lite Terraform integration needs: [test-unit, changes] if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos_lite == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@main + uses: canonical/observability-stack/.github/workflows/_integration.yml@feat/juju-v4-support-main with: product: cos_lite runner: self-hosted-linux-amd64-noble-large @@ -102,7 +102,7 @@ jobs: name: COS Terraform integration needs: [test-unit, changes] if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@main + uses: canonical/observability-stack/.github/workflows/_integration.yml@feat/juju-v4-support-main with: product: cos runner: self-hosted-linux-amd64-noble-xlarge From b26fbd74c814337ffd07b98aadd3faa870df83ff Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 16 Jul 2026 14:32:06 -0400 Subject: [PATCH 3/5] chore --- terraform/cos-lite/terraform.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/cos-lite/terraform.tf b/terraform/cos-lite/terraform.tf index 337ffdaf..acaf7764 100644 --- a/terraform/cos-lite/terraform.tf +++ b/terraform/cos-lite/terraform.tf @@ -9,3 +9,4 @@ terraform { } } } +# TODO: Remove when done testing \ No newline at end of file From dba27da342737d34968049e07261f4850e805bad Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 16 Jul 2026 14:35:26 -0400 Subject: [PATCH 4/5] chore --- .github/workflows/terraform.yml | 1 + terraform/cos-lite/terraform.tf | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 889ef7c2..cd15db67 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -5,6 +5,7 @@ on: pull_request: paths: - "**/*.tf" + - "tests/integration/**" jobs: lint-terraform: diff --git a/terraform/cos-lite/terraform.tf b/terraform/cos-lite/terraform.tf index acaf7764..48b8193d 100644 --- a/terraform/cos-lite/terraform.tf +++ b/terraform/cos-lite/terraform.tf @@ -8,5 +8,4 @@ terraform { version = ">= 1.4.0" } } -} -# TODO: Remove when done testing \ No newline at end of file +} \ No newline at end of file From 6acda16a78cc1a8183589328d91499d6047b7a27 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Thu, 16 Jul 2026 15:26:52 -0400 Subject: [PATCH 5/5] chore --- .github/workflows/terraform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index cd15db67..7164cc25 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -95,7 +95,7 @@ jobs: name: COS Lite Terraform integration needs: [test-unit, changes] if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos_lite == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@feat/juju-v4-support-main + uses: canonical/observability-stack/.github/workflows/_integration.yml@main with: product: cos_lite runner: self-hosted-linux-amd64-noble-large @@ -103,7 +103,7 @@ jobs: name: COS Terraform integration needs: [test-unit, changes] if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.cos == 'true' }} - uses: canonical/observability-stack/.github/workflows/_integration.yml@feat/juju-v4-support-main + uses: canonical/observability-stack/.github/workflows/_integration.yml@main with: product: cos runner: self-hosted-linux-amd64-noble-xlarge