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/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 95c8cd15..7164cc25 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 337ffdaf..48b8193d 100644 --- a/terraform/cos-lite/terraform.tf +++ b/terraform/cos-lite/terraform.tf @@ -8,4 +8,4 @@ terraform { version = ">= 1.4.0" } } -} +} \ No newline at end of file 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)