Skip to content
Merged
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
14 changes: 13 additions & 1 deletion .github/workflows/_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,16 @@ jobs:
export S3_ACCESS_KEY=access-key
export S3_SECRET_KEY=secret-key
fi
just integration ${{ inputs.product }}/${{ matrix.scenario }}
if [[ "${{ runner.debug }}" == "1" ]]; then
export KEEP_MODELS=true
just integration ${{ inputs.product }}/${{ matrix.scenario }} --keep-models
else
just integration ${{ inputs.product }}/${{ matrix.scenario }}
fi

- name: Open SSH session on failure
if: ${{ failure() && (runner.debug == '1') }}
uses: mxschmitt/action-tmate@v3
with:
timeout-minutes: 30
limit-access-to-actor: true
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ unit-test module:
[group("Integration")]
[working-directory("./tests/integration")]
integration *args='':
uv run ${uv_flags} pytest -vv -ra --capture=no --exitfirst "${args}"
uv run ${uv_flags} pytest -vv -ra --capture=no --exitfirst {{args}}
26 changes: 20 additions & 6 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,31 @@
from helpers import TfDirManager


def pytest_addoption(parser):
parser.addoption(
"--keep-models",
action="store_true",
default=False,
help="Keep temporarily-created models instead of destroying them after the tests run.",
)


def _keep_models(request) -> bool:
"""Whether to keep temporary models, via CLI flag or the KEEP_MODELS env var."""
return bool(request.config.getoption("--keep-models")) or (
os.environ.get("KEEP_MODELS") is not None
)


@pytest.fixture(scope="module")
def ca_model():
keep_models: bool = os.environ.get("KEEP_MODELS") is not None
with jubilant.temp_model(keep=keep_models) as juju:
def ca_model(request):
with jubilant.temp_model(keep=_keep_models(request)) as juju:
yield juju


@pytest.fixture(scope="module")
def cos_model():
keep_models: bool = os.environ.get("KEEP_MODELS") is not None
with jubilant.temp_model(keep=keep_models) as juju:
def cos_model(request):
with jubilant.temp_model(keep=_keep_models(request)) as juju:
yield juju


Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos/tls_external/track-3.0.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module "ssc" {
}

module "cos" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos?ref=track/3.0"
source = "git::https://github.com/canonical/observability-stack//terraform/cos?ref=track/3.0"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "stable"
internal_tls = false
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos/tls_external/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module "ssc" {
}

module "cos" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos"
source = "git::https://github.com/canonical/observability-stack//terraform/cos"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "edge"
internal_tls = false
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos/tls_full/track-3.0.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module "ssc" {
}

module "cos" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos?ref=track/3.0"
source = "git::https://github.com/canonical/observability-stack//terraform/cos?ref=track/3.0"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "stable"
internal_tls = true
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos/tls_full/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ module "ssc" {
}

module "cos" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos"
source = "git::https://github.com/canonical/observability-stack//terraform/cos"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "edge"
internal_tls = true
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_dev/tls_external/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module "ssc" {
}

module "cos-dev" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-dev"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-dev"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model_uuid = data.juju_model.cos-model.uuid
risk = "edge"
internal_tls = false
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_dev/tls_full/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module "ssc" {
}

module "cos-dev" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-dev"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-dev"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model_uuid = data.juju_model.cos-model.uuid
risk = "edge"
internal_tls = true
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_lite/tls_external/track-3.0.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ module "ssc" {
}

module "cos-lite" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite?ref=track/3.0"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite?ref=track/3.0"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "stable"
internal_tls = false
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_lite/tls_external/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module "ssc" {
}

module "cos-lite" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "edge"
internal_tls = false
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_lite/tls_full/track-3.0.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module "ssc" {
}

module "cos-lite" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite?ref=track/3.0"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite?ref=track/3.0"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "stable"
internal_tls = true
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/cos_lite/tls_full/track-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ module "ssc" {
}

module "cos-lite" {
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite"
source = "git::https://github.com/canonical/observability-stack//terraform/cos-lite"
depends_on = [module.ssc] # Ensure the CA model's offers exist before COS consumes them.

model = { uuid = data.juju_model.cos-model.uuid }
risk = "edge"
internal_tls = true
Expand Down
Loading