Skip to content

Commit

Permalink
Attempt to run integration tests on juju 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
shayancanonical committed Sep 9, 2024
1 parent a3f363a commit 6cc2b74
Show file tree
Hide file tree
Showing 21 changed files with 138 additions and 53 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ concurrency:
cancel-in-progress: true

on:
pull_request:
paths-ignore:
- '.gitignore'
- '.jujuignore'
- 'LICENSE'
- '**.md'
- .github/renovate.json5
- '.github/workflows/sync_docs.yaml'
# TODO: uncomment below before PR merge
# pull_request:
# paths-ignore:
# - '.gitignore'
# - '.jujuignore'
# - 'LICENSE'
# - '**.md'
# - .github/renovate.json5
# - '.github/workflows/sync_docs.yaml'
schedule:
- cron: '53 0 * * *' # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/juju_3_6_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.
name: Juju 3.6 CI tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:

jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v18.0.0

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v18.0.0
with:
cache: true

integration-test-3-6:
strategy:
fail-fast: false
matrix:
architecture:
- amd64
- arm64
name: Integration | 3.6 | ${{ matrix.architecture }}
needs:
- lint
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v18.0.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
cloud: microk8s
juju-snap-channel: 3.6/beta
libjuju-version-constraint: 3.5.2.0
microk8s-snap-channel: 1.31-strict/stable
secrets:
# GitHub appears to redact each line of a multi-line secret
# Avoid putting `{` or `}` on a line by itself so that it doesn't get redacted in logs
integration-test: |
{ "AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
}
9 changes: 7 additions & 2 deletions tests/integration/ha_tests/test_async_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .. import architecture, markers
from ..helpers import (
APPLICATION_NAME,
CHARM_BASE,
DATABASE_APP_NAME,
build_and_deploy,
get_leader_unit,
Expand Down Expand Up @@ -112,8 +113,12 @@ async def test_deploy_async_replication_setup(
"""Build and deploy two PostgreSQL cluster in two separate models to test async replication."""
await build_and_deploy(ops_test, CLUSTER_SIZE, wait_for_idle=False)
await build_and_deploy(ops_test, CLUSTER_SIZE, wait_for_idle=False, model=second_model)
await ops_test.model.deploy(APPLICATION_NAME, channel="latest/edge", num_units=1)
await second_model.deploy(APPLICATION_NAME, channel="latest/edge", num_units=1)
await ops_test.model.deploy(
APPLICATION_NAME, channel="latest/edge", num_units=1, base=CHARM_BASE
)
await second_model.deploy(
APPLICATION_NAME, channel="latest/edge", num_units=1, base=CHARM_BASE
)

async with ops_test.fast_forward(), fast_forward(second_model):
await gather(
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/test_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ..helpers import (
APPLICATION_NAME,
CHARM_SERIES,
CHARM_BASE,
app_name,
build_and_deploy,
db_connect,
Expand Down Expand Up @@ -43,7 +43,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
APPLICATION_NAME,
application_name=APPLICATION_NAME,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
)

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/ha_tests/test_rollback_to_master_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..architecture import architecture
from ..helpers import (
APPLICATION_NAME,
CHARM_SERIES,
CHARM_BASE,
DATABASE_APP_NAME,
get_leader_unit,
get_primary,
Expand Down Expand Up @@ -45,13 +45,14 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:
num_units=3,
channel="14/stable",
revision=(280 if architecture == "arm64" else 281),
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
),
ops_test.model.deploy(
APPLICATION_NAME,
num_units=1,
channel="latest/edge",
base=CHARM_BASE,
),
)
logger.info("Wait for applications to become active")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ha_tests/test_self_healing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .. import markers
from ..helpers import (
APPLICATION_NAME,
CHARM_SERIES,
CHARM_BASE,
METADATA,
app_name,
build_and_deploy,
Expand Down Expand Up @@ -69,7 +69,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
await ops_test.model.deploy(
APPLICATION_NAME,
application_name=APPLICATION_NAME,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ha_tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from .. import markers
from ..helpers import (
CHARM_SERIES,
CHARM_BASE,
DATABASE_APP_NAME,
scale_application,
)
Expand Down Expand Up @@ -56,7 +56,7 @@ async def test_app_force_removal(ops_test: OpsTest):
application_name=DATABASE_APP_NAME,
num_units=1,
channel="14/stable",
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
config={"profile": "testing"},
)
Expand Down Expand Up @@ -169,7 +169,7 @@ async def test_app_resources_conflicts(ops_test: OpsTest):
application_name=DUP_DATABASE_APP_NAME,
num_units=1,
channel="14/stable",
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
config={"profile": "testing"},
)
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/ha_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from ..helpers import (
APPLICATION_NAME,
CHARM_BASE,
DATABASE_APP_NAME,
METADATA,
count_switchovers,
Expand Down Expand Up @@ -44,11 +45,13 @@ async def test_deploy_latest(ops_test: OpsTest) -> None:
channel="14/edge",
trust=True,
config={"profile": "testing"},
base=CHARM_BASE,
),
ops_test.model.deploy(
APPLICATION_NAME,
num_units=1,
channel="latest/edge",
base=CHARM_BASE,
),
)
logger.info("Wait for applications to become active")
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/ha_tests/test_upgrade_from_stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .. import markers
from ..helpers import (
APPLICATION_NAME,
CHARM_BASE,
DATABASE_APP_NAME,
METADATA,
count_switchovers,
Expand Down Expand Up @@ -42,11 +43,13 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:
num_units=3,
channel="14/stable",
trust=True,
base=CHARM_BASE,
),
ops_test.model.deploy(
APPLICATION_NAME,
num_units=1,
channel="latest/edge",
base=CHARM_BASE,
),
)
logger.info("Wait for applications to become active")
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/ha_tests/test_upgrade_to_primary_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from .. import markers
from ..helpers import (
APPLICATION_NAME,
CHARM_BASE,
DATABASE_APP_NAME,
get_leader_unit,
get_primary,
Expand Down Expand Up @@ -40,11 +41,13 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:
num_units=3,
channel="14/stable",
trust=True,
base=CHARM_BASE,
),
ops_test.model.deploy(
APPLICATION_NAME,
num_units=1,
channel="latest/edge",
base=CHARM_BASE,
),
)
logger.info("Wait for applications to become active")
Expand Down
11 changes: 7 additions & 4 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
wait_fixed,
)

CHARM_SERIES = "jammy"
CHARM_BASE = "ubuntu@22.04"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
DATABASE_APP_NAME = METADATA["name"]
APPLICATION_NAME = "postgresql-test-app"
Expand Down Expand Up @@ -94,7 +94,7 @@ async def build_and_deploy(
application_name=database_app_name,
trust=True,
num_units=num_units,
series=CHARM_SERIES,
base=CHARM_BASE,
config={"profile": "testing"},
),
)
Expand Down Expand Up @@ -293,6 +293,7 @@ async def deploy_and_relate_application_with_postgresql(
channel=channel,
application_name=application_name,
num_units=number_of_units,
base=CHARM_BASE,
)
await ops_test.model.wait_for_idle(
apps=[application_name],
Expand Down Expand Up @@ -828,8 +829,10 @@ async def backup_operations(
) -> None:
"""Basic set of operations for backup testing in different cloud providers."""
# Deploy S3 Integrator and TLS Certificates Operator.
await ops_test.model.deploy(s3_integrator_app_name)
await ops_test.model.deploy(tls_certificates_app_name, config=tls_config, channel=tls_channel)
await ops_test.model.deploy(s3_integrator_app_name, base=CHARM_BASE)
await ops_test.model.deploy(
tls_certificates_app_name, config=tls_config, channel=tls_channel, base=CHARM_BASE
)
# Deploy and relate PostgreSQL to S3 integrator (one database app for each cloud for now
# as archivo_mode is disabled after restoring the backup) and to TLS Certificates Operator
# (to be able to create backups from replicas).
Expand Down
29 changes: 18 additions & 11 deletions tests/integration/new_relations/test_new_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .. import markers
from ..helpers import (
CHARM_SERIES,
CHARM_BASE,
check_database_users_existence,
scale_application,
)
Expand Down Expand Up @@ -56,7 +56,7 @@ async def test_database_relation_with_charm_libraries(ops_test: OpsTest, databas
APPLICATION_APP_NAME,
application_name=APPLICATION_APP_NAME,
num_units=2,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
),
ops_test.model.deploy(
Expand All @@ -68,7 +68,7 @@ async def test_database_relation_with_charm_libraries(ops_test: OpsTest, databas
},
application_name=DATABASE_APP_NAME,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
config={"profile": "testing"},
),
Expand All @@ -81,7 +81,7 @@ async def test_database_relation_with_charm_libraries(ops_test: OpsTest, databas
},
application_name=ANOTHER_DATABASE_APP_NAME,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
config={"profile": "testing"},
),
Expand Down Expand Up @@ -192,7 +192,7 @@ async def test_two_applications_doesnt_share_the_same_relation_data(ops_test: Op
await ops_test.model.deploy(
APPLICATION_APP_NAME,
application_name=another_application_app_name,
series=CHARM_SERIES,
base=CHARM_BASE,
channel="edge",
)
await ops_test.model.wait_for_idle(apps=all_app_names, status="active")
Expand Down Expand Up @@ -449,7 +449,7 @@ async def test_admin_role(ops_test: OpsTest):
all_app_names = [DATA_INTEGRATOR_APP_NAME]
all_app_names.extend(APP_NAMES)
async with ops_test.fast_forward():
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME)
await ops_test.model.deploy(DATA_INTEGRATOR_APP_NAME, base=CHARM_BASE)
await ops_test.model.wait_for_idle(apps=[DATA_INTEGRATOR_APP_NAME], status="blocked")
await ops_test.model.applications[DATA_INTEGRATOR_APP_NAME].set_config({
"database-name": DATA_INTEGRATOR_APP_NAME.replace("-", "_"),
Expand Down Expand Up @@ -538,7 +538,9 @@ async def test_invalid_extra_user_roles(ops_test: OpsTest):
another_data_integrator_app_name = f"another-{DATA_INTEGRATOR_APP_NAME}"
data_integrator_apps_names = [DATA_INTEGRATOR_APP_NAME, another_data_integrator_app_name]
await ops_test.model.deploy(
DATA_INTEGRATOR_APP_NAME, application_name=another_data_integrator_app_name
DATA_INTEGRATOR_APP_NAME,
application_name=another_data_integrator_app_name,
base=CHARM_BASE,
)
await ops_test.model.wait_for_idle(
apps=[another_data_integrator_app_name], status="blocked"
Expand Down Expand Up @@ -593,7 +595,7 @@ async def test_discourse(ops_test: OpsTest):
await gather(
ops_test.model.deploy(DISCOURSE_APP_NAME, application_name=DISCOURSE_APP_NAME),
ops_test.model.deploy(
REDIS_APP_NAME, application_name=REDIS_APP_NAME, channel="latest/edge"
REDIS_APP_NAME, application_name=REDIS_APP_NAME, channel="latest/edge", base=CHARM_BASE
),
)

Expand Down Expand Up @@ -670,12 +672,17 @@ async def test_indico_datatabase(ops_test: OpsTest) -> None:
async with ops_test.fast_forward(fast_interval="30s"):
await ops_test.model.deploy(
"indico",
channel="stable",
channel="latest/edge",
application_name="indico",
num_units=1,
base=CHARM_BASE,
)
await ops_test.model.deploy(
"redis-k8s", channel="stable", application_name="redis-broker", base=CHARM_BASE
)
await ops_test.model.deploy(
"redis-k8s", channel="stable", application_name="redis-cache", base=CHARM_BASE
)
await ops_test.model.deploy("redis-k8s", channel="stable", application_name="redis-broker")
await ops_test.model.deploy("redis-k8s", channel="stable", application_name="redis-cache")
await asyncio.gather(
ops_test.model.relate("redis-broker", "indico:redis-broker"),
ops_test.model.relate("redis-cache", "indico:redis-cache"),
Expand Down
Loading

0 comments on commit 6cc2b74

Please sign in to comment.