Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pin integration test dependencies, refactor constants in tests for track/ckf-1.8 #145

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Changes from 1 commit
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
39 changes: 24 additions & 15 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

from pathlib import Path

import pytest
import yaml
from pytest_operator.plugin import OpsTest

# Test dependencies
DEX_AUTH = "dex-auth"
DEX_AUTH_CHANNEL = "2.36/stable"
TRUST_DEX_AUTH = True
ISTIO_PILOT = "istio-pilot"
ISTIO_PILOT_CHANNEL = "1.17/stable"
TRUST_ISTIO_PILOT = True

METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
PUBLIC_URL = "test-url"
APP_NAME = METADATA["name"]
APP_PREV_VERSION = "ckf-1.7/stable"
TRUST_PREV_APP = True
PREVIOUS_RELEASE = "ckf-1.7/stable"
PREVIOUS_RELEASE_TRUST = True
OIDC_CONFIG = {
"client-name": "Ambassador Auth OIDC",
"client-secret": "oidc-client-secret",
}

ISTIO_PILOT = "istio-pilot"
ISTIO_PILOT_CHANNEL = "1.17/stable"
ISTIO_PILOT_TRUST = True

DEX_AUTH = "dex-auth"
DEX_AUTH_CHANNEL = "2.31/stable"
ca-scribner marked this conversation as resolved.
Show resolved Hide resolved
DEX_AUTH_TRUST = True
PUBLIC_URL = "test-url"

image_path = METADATA["resources"]["oci-image"]["upstream-source"]
RESOURCES = {"oci-image": image_path}

Expand All @@ -46,7 +47,10 @@ async def test_deploy(self, ops_test: OpsTest):
Assert on the unit status.
"""
await ops_test.model.deploy(
pytest.charm_under_test, resources=RESOURCES, trust=True, config=OIDC_CONFIG
pytest.charm_under_test,
resources=RESOURCES,
trust=True,
config=OIDC_CONFIG,
)

await ops_test.model.applications[APP_NAME].set_config({"public-url": PUBLIC_URL})
Expand All @@ -59,9 +63,11 @@ async def test_deploy(self, ops_test: OpsTest):
@pytest.mark.abort_on_fail
async def test_relations(self, ops_test: OpsTest):
await ops_test.model.deploy(
ISTIO_PILOT, channel=ISTIO_PILOT_CHANNEL, trust=TRUST_ISTIO_PILOT
ISTIO_PILOT,
channel=ISTIO_PILOT_CHANNEL,
trust=ISTIO_PILOT_TRUST,
)
await ops_test.model.deploy(DEX_AUTH, channel=DEX_AUTH_CHANNEL, trust=TRUST_DEX_AUTH)
await ops_test.model.deploy(DEX_AUTH, channel=DEX_AUTH_CHANNEL, trust=DEX_AUTH_TRUST)
await ops_test.model.add_relation(ISTIO_PILOT, DEX_AUTH)
await ops_test.model.add_relation(f"{ISTIO_PILOT}:ingress", f"{APP_NAME}:ingress")
await ops_test.model.add_relation(
Expand Down Expand Up @@ -99,7 +105,10 @@ async def test_upgrade(self, ops_test: OpsTest):
"""
print(f"Deploy {APP_NAME} from stable channel")
await ops_test.model.deploy(
APP_NAME, channel=APP_PREV_VERSION, trust=TRUST_PREV_APP, config=OIDC_CONFIG
APP_NAME,
channel=PREVIOUS_RELEASE,
trust=PREVIOUS_RELEASE_TRUST,
config=OIDC_CONFIG,
)
await ops_test.model.add_relation(f"{ISTIO_PILOT}:ingress", f"{APP_NAME}:ingress")
await ops_test.model.add_relation(
Expand Down
Loading