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

[DPE-4977] Run integration tests against Juju 3.6 #689

Merged
merged 18 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6cc2b74
Attempt to run integration tests on juju 3.6
shayancanonical Sep 9, 2024
52271e1
Change pgdata permissions to 0o700 + fix charm bases in tests
shayancanonical Sep 23, 2024
72696f1
Merge branch 'main' into feature/juju_3_6_tests
shayancanonical Sep 23, 2024
42a9e01
Remove import to fix lint warning
shayancanonical Sep 23, 2024
e7d7b5a
Set pg data permissions to 750 explicitly so it works well with pgbac…
shayancanonical Sep 24, 2024
e42332d
Use base [email protected] for finos-waltz-k8s
shayancanonical Sep 24, 2024
47dfc6b
Deploy charms without jammy support with base [email protected]
shayancanonical Sep 24, 2024
0e198f9
Test against juju 3.6/edge due to secrets related fixes + deploy matt…
shayancanonical Oct 2, 2024
a70e4fc
Merge branch 'main' into feature/juju_3_6_tests
shayancanonical Oct 2, 2024
f39d919
Run tests against juju 3.6/stable
shayancanonical Nov 7, 2024
9b5cd2c
Merge branch 'main' into feature/juju_3_6_tests
shayancanonical Nov 7, 2024
95d869d
Run tests against 3.6/candidate and not 3.6/stable
shayancanonical Nov 7, 2024
7107c2a
Merge branch 'main' into feature/juju_3_6_tests
shayancanonical Nov 7, 2024
29ae647
Run juju 3.6 tests only on a nightly schedule
shayancanonical Nov 13, 2024
5a6bca9
Merge branch 'main' into feature/juju_3_6_tests
shayancanonical Nov 13, 2024
61a55ce
Address missed case of series->base after merge of main into branch
shayancanonical Nov 13, 2024
2e95476
Address Dragomir's feedback on test failures due to nuances of python…
shayancanonical Nov 14, 2024
8ad2403
Use series for the indico charm as the usage of bases shows incompati…
shayancanonical Nov 14, 2024
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ jobs:
allure_on_amd64: false
- agent: 3.4.6 # renovate: juju-agent-pin-minor
allure_on_amd64: true
- snap_channel: 3.6/candidate
allure_on_amd64: false
architecture:
- amd64
include:
- juju:
agent: 3.4.6 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture: arm64
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
- juju:
snap_channel: 3.6/candidate
allure_on_amd64: false
architecture: arm64
name: Integration | ${{ matrix.juju.agent || matrix.juju.snap_channel }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
Expand All @@ -78,6 +84,7 @@ jobs:
cloud: microk8s
microk8s-snap-channel: 1.31-strict/stable # renovate: latest microk8s
juju-agent-version: ${{ matrix.juju.agent }}
juju-snap-channel: ${{ matrix.juju.snap_channel }}
libjuju-version-constraint: ${{ matrix.juju.libjuju }}
_beta_allure_report: ${{ matrix.juju.allure_on_amd64 && matrix.architecture == 'amd64' }}
secrets:
Expand Down
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
dragomirp marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -47,13 +47,14 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:
num_units=3,
channel="14/stable",
revision=LABEL_REVISION,
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
5 changes: 3 additions & 2 deletions tests/integration/ha_tests/test_upgrade_to_primary_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 @@ -42,13 +42,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,
trust=True,
base=CHARM_BASE,
shayancanonical marked this conversation as resolved.
Show resolved Hide resolved
),
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
13 changes: 9 additions & 4 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
wait_fixed,
)

CHARM_SERIES = "jammy"
CHARM_BASE = "[email protected]"
METADATA = yaml.safe_load(Path("./metadata.yaml").read_text())
DATABASE_APP_NAME = METADATA["name"]
APPLICATION_NAME = "postgresql-test-app"
Expand Down Expand Up @@ -100,7 +100,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 @@ -277,6 +277,7 @@ async def deploy_and_relate_application_with_postgresql(
channel: str = "stable",
relation: str = "db",
status: str = "blocked",
base: str = CHARM_BASE,
) -> int:
"""Helper function to deploy and relate application with PostgreSQL.

Expand All @@ -289,6 +290,7 @@ async def deploy_and_relate_application_with_postgresql(
relation: Name of the PostgreSQL relation to relate
the application to.
status: The status to wait for in the application (default: blocked).
base: The base of the charm to deploy

Returns:
the id of the created relation.
Expand All @@ -299,6 +301,7 @@ async def deploy_and_relate_application_with_postgresql(
channel=channel,
application_name=application_name,
num_units=number_of_units,
base=base,
)
await ops_test.model.wait_for_idle(
apps=[application_name],
Expand Down Expand Up @@ -837,8 +840,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
31 changes: 19 additions & 12 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 @@ -196,7 +196,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 @@ -453,7 +453,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 @@ -542,7 +542,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 @@ -607,7 +609,7 @@ async def test_database_deploy_clientapps(ops_test: OpsTest, database_charm):
},
application_name=DATABASE_APP_NAME,
num_units=3,
series=CHARM_SERIES,
base=CHARM_BASE,
trust=True,
config={"profile": "testing"},
),
Expand All @@ -628,7 +630,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 @@ -705,12 +707,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,
shayancanonical marked this conversation as resolved.
Show resolved Hide resolved
)
await ops_test.model.deploy(
"redis-k8s", channel="stable", application_name="redis-broker", base="[email protected]"
)
await ops_test.model.deploy(
"redis-k8s", channel="stable", application_name="redis-cache", base="[email protected]"
)
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
4 changes: 2 additions & 2 deletions tests/integration/new_relations/test_relations_coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest
from pytest_operator.plugin import OpsTest

from ..helpers import DATABASE_APP_NAME, build_and_deploy
from ..helpers import CHARM_BASE, DATABASE_APP_NAME, build_and_deploy
from .helpers import build_connection_string
from .test_new_relations import DATA_INTEGRATOR_APP_NAME

Expand All @@ -30,7 +30,7 @@ async def test_relations(ops_test: OpsTest, database_charm):
await ops_test.model.wait_for_idle(apps=[DATABASE_APP_NAME], status="active", timeout=3000)

# Creating first time relation with user role
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.applications[DATA_INTEGRATOR_APP_NAME].set_config({
"database-name": DATA_INTEGRATOR_APP_NAME.replace("-", "_"),
})
Expand Down
Loading
Loading