Skip to content

Commit

Permalink
[DPE-4976] Add workflow for nightly scheduled tests with juju 3.6 (#490)
Browse files Browse the repository at this point in the history
* Add temporary CI file to run juju 3.6 tests on branch PR

* Explicitly use base instead of series, and hardcode base as [email protected]

* Add --base to a missed deploy command

* Use channel 3/stable for kafka-k8s and zookeeper-k8s charms

* Revert kafka and zookeeper to use latest/stable with base [email protected]

* Merge juju 3.6 workflow file into CI workflow file + upgrade to dpw v21.0.0

* Update outdated charm_tracing charm lib

* Avoid setting revision for mongodb-k8s

* Revert deployment of mongodb-k8s in mysql_root test

* Use --base or --series based on juju version in test_mysql_root
  • Loading branch information
shayancanonical authored Aug 29, 2024
1 parent 52df626 commit b18062d
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 43 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,32 @@ jobs:
allure_on_amd64: false
- agent: 3.4.5 # renovate: juju-agent-pin-minor
allure_on_amd64: true
- snap_channel: 3.6/beta
allure_on_amd64: false
architecture:
- amd64
include:
- juju:
agent: 3.4.5 # renovate: juju-agent-pin-minor
allure_on_amd64: true
architecture: arm64
name: Integration | ${{ matrix.juju.agent }} | ${{ matrix.architecture }}
- juju:
snap_channel: 3.6/beta
allure_on_amd64: false
architecture: arm64
name: Integration | ${{ matrix.juju.agent || matrix.juju.snap_channel }} | ${{ matrix.architecture }}
needs:
- lint
- unit-test
- build
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v20.0.2
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v21.0.0
with:
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
architecture: ${{ matrix.architecture }}
cloud: microk8s
microk8s-snap-channel: 1.28-strict/stable
microk8s-snap-channel: 1.28-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
17 changes: 14 additions & 3 deletions lib/charms/tempo_k8s/v1/charm_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def _remove_stale_otel_sdk_packages():

_remove_stale_otel_sdk_packages()


import functools
import inspect
import logging
Expand Down Expand Up @@ -271,7 +270,7 @@ def _remove_stale_otel_sdk_packages():
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version

LIBPATCH = 14
LIBPATCH = 15

PYDEPS = ["opentelemetry-exporter-otlp-proto-http==1.21.0"]

Expand All @@ -281,7 +280,6 @@ def _remove_stale_otel_sdk_packages():
# set this to 0 if you are debugging/developing this library source
dev_logger.setLevel(logging.CRITICAL)


_CharmType = Type[CharmBase] # the type CharmBase and any subclass thereof
_C = TypeVar("_C", bound=_CharmType)
_T = TypeVar("_T", bound=type)
Expand Down Expand Up @@ -333,9 +331,22 @@ def _get_tracer() -> Optional[Tracer]:
try:
return tracer.get()
except LookupError:
# fallback: this course-corrects for a user error where charm_tracing symbols are imported
# from different paths (typically charms.tempo_k8s... and lib.charms.tempo_k8s...)
try:
ctx: Context = copy_context()
if context_tracer := _get_tracer_from_context(ctx):
logger.warning(
"Tracer not found in `tracer` context var. "
"Verify that you're importing all `charm_tracing` symbols from the same module path. \n"
"For example, DO"
": `from charms.lib...charm_tracing import foo, bar`. \n"
"DONT: \n"
" \t - `from charms.lib...charm_tracing import foo` \n"
" \t - `from lib...charm_tracing import bar` \n"
"For more info: https://python-notes.curiousefficiency.org/en/latest/python"
"_concepts/import_traps.html#the-double-import-trap"
)
return context_tracer.get()
else:
return None
Expand Down
23 changes: 11 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ parameterized = "^0.9.0"

[tool.poetry.group.integration.dependencies]
pytest = "^7.4.0"
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v20.0.2", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-github-secrets = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/github_secrets"}
pytest-microceph = {git = "https://github.com/canonical/data-platform-workflows", tag = "v20.0.2", subdirectory = "python/pytest_plugins/microceph"}
pytest-operator = "^0.28.0"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v20.0.2", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v20.0.2", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.2.2"
pytest-operator-cache = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/pytest_operator_cache"}
pytest-operator-groups = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/pytest_operator_groups"}
juju = "^3.5.2.0"
ops = "^2.15.0"
mysql-connector-python = "~8.0.33"
tenacity = "^8.2.2"
Expand All @@ -65,7 +65,7 @@ urllib3 = "^1.26.16"
lightkube = "^0.14.0"
kubernetes = "^27.2.0"
allure-pytest = "^2.13.2"
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v20.0.2", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
allure-pytest-collection-report = {git = "https://github.com/canonical/data-platform-workflows", tag = "v21.0.0", subdirectory = "python/pytest_plugins/allure_pytest_collection_report"}
pytest-asyncio = "^0.21.1"

[tool.coverage.run]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async def deploy_and_scale_mysql(
config=config,
resources=resources,
num_units=num_units,
series="jammy",
base="[email protected]",
trust=True,
)

Expand Down Expand Up @@ -198,6 +198,7 @@ async def deploy_and_scale_application(ops_test: OpsTest) -> str:
application_name=APPLICATION_DEFAULT_APP_NAME,
num_units=1,
channel="latest/edge",
base="[email protected]",
)

await ops_test.model.wait_for_idle(
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/high_availability/test_async_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async def test_build_and_deploy(
config=config,
resources=resources,
trust=True,
base="[email protected]",
)
config["cluster-name"] = "cuzco"
await second_model.deploy(
Expand All @@ -99,6 +100,7 @@ async def test_build_and_deploy(
config=config,
resources=resources,
trust=True,
base="[email protected]",
)

logger.info("Waiting for the applications to settle")
Expand Down Expand Up @@ -193,15 +195,15 @@ async def test_deploy_router_and_app(first_model: Model) -> None:
await first_model.deploy(
MYSQL_ROUTER_APP_NAME,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
channel="8.0/edge",
num_units=1,
trust=True,
)
await first_model.deploy(
APPLICATION_APP_NAME,
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
channel="latest/edge",
num_units=1,
)
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/high_availability/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ async def test_deploy_latest(ops_test: OpsTest) -> None:
channel="8.0/edge",
trust=True,
config={"profile": "testing"},
base="[email protected]",
)
await ops_test.model.deploy(
TEST_APP_NAME,
application_name=TEST_APP_NAME,
num_units=1,
channel="latest/edge",
base="[email protected]",
)

await relate_mysql_and_application(ops_test, MYSQL_APP_NAME, TEST_APP_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ async def test_deploy_stable(ops_test: OpsTest) -> None:
channel="8.0/stable",
trust=True,
config={"profile": "testing"},
base="[email protected]",
),
ops_test.model.deploy(
f"mysql-{TEST_APP_NAME}",
application_name=TEST_APP_NAME,
num_units=1,
channel="latest/edge",
base="[email protected]",
),
)
await relate_mysql_and_application(ops_test, MYSQL_APP_NAME, TEST_APP_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
num_units=3,
resources=resources,
trust=True,
base="[email protected]",
)

await ops_test.model.wait_for_idle(
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/relations/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ async def test_build_and_deploy(ops_test: OpsTest):
config=config,
num_units=3,
resources=resources,
series="jammy",
base="[email protected]",
trust=True,
),
ops_test.model.deploy(
APPLICATION_APP_NAME,
application_name=APPLICATION_APP_NAME,
num_units=2,
channel="latest/edge",
base="[email protected]",
),
)

Expand Down
36 changes: 26 additions & 10 deletions tests/integration/relations/test_mysql_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
get_unit_address,
is_relation_joined,
)
from ..juju_ import juju_major_version

logger = logging.getLogger(__name__)

Expand All @@ -44,38 +45,53 @@ async def test_deploy_and_relate_osm_bundle(ops_test: OpsTest) -> None:
"image": "opensourcemano/pol:testing-daily",
}

osm_keystone_deploy_commands = [
"deploy",
"--channel=latest/beta",
"--resource",
"keystone-image=opensourcemano/keystone:testing-daily",
"osm-keystone",
]

if juju_major_version >= 3:
osm_keystone_deploy_commands.extend(["--base", "[email protected]"])
else:
osm_keystone_deploy_commands.extend(["--series", "jammy"])

await asyncio.gather(
ops_test.model.deploy(
charm,
application_name=APP_NAME,
resources=resources,
config=config,
num_units=1,
series="jammy",
base="[email protected]",
trust=True,
),
# Deploy the osm-keystone charm
# (using ops_test.juju instead of ops_test.deploy as the latter does
# not correctly deploy with the correct resources)
ops_test.juju(
"deploy",
"--channel=latest/beta",
"--resource",
"keystone-image=opensourcemano/keystone:testing-daily",
"osm-keystone",
),
ops_test.juju(*osm_keystone_deploy_commands),
ops_test.model.deploy(
"osm-pol",
application_name="osm-pol",
channel="latest/beta",
resources=osm_pol_resources,
trust=True,
base="[email protected]",
),
ops_test.model.deploy(
"kafka-k8s", application_name="kafka", trust=True, channel="latest/stable"
"kafka-k8s",
application_name="kafka",
trust=True,
channel="latest/stable",
base="[email protected]",
),
ops_test.model.deploy(
"zookeeper-k8s", application_name="zookeeper", channel="latest/stable"
"zookeeper-k8s",
application_name="zookeeper",
channel="latest/stable",
base="[email protected]",
),
# sticking to revision that support both juju 2.9.x and 3.x
ops_test.model.deploy(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_backup_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:

logger.info("Deploying s3-integrator")

await ops_test.model.deploy(S3_INTEGRATOR, channel="stable")
await ops_test.model.deploy(S3_INTEGRATOR, channel="stable", base="[email protected]")
await ops_test.model.relate(mysql_application_name, S3_INTEGRATOR)

await ops_test.model.wait_for_idle(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_backup_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:

logger.info("Deploying s3-integrator")

await ops_test.model.deploy(S3_INTEGRATOR, channel="stable")
await ops_test.model.deploy(S3_INTEGRATOR, channel="stable", base="[email protected]")
await ops_test.model.relate(mysql_application_name, S3_INTEGRATOR)

await ops_test.model.wait_for_idle(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_backup_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:

logger.info("Deploying s3-integrator")

await ops_test.model.deploy(S3_INTEGRATOR, channel="stable")
await ops_test.model.deploy(S3_INTEGRATOR, channel="stable", base="[email protected]")
await ops_test.model.relate(mysql_application_name, S3_INTEGRATOR)

await ops_test.model.wait_for_idle(
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def test_build_and_deploy(ops_test: OpsTest) -> None:
application_name=APP_NAME,
config=config,
num_units=3,
series="jammy",
base="[email protected]",
trust=True,
)

Expand Down
Loading

0 comments on commit b18062d

Please sign in to comment.