Skip to content

Commit

Permalink
[DPE-4976] Run tests on juju 3.6 on a nightly schedule (#311)
Browse files Browse the repository at this point in the history
## Issue
We would like to run nightly tests with juju 3.6

## Solution
Upgrade to dpw v21.0.0 and add juju 3.6 into the matrix for tests. Also,
upgrade libjuju to ^3.5.2.0
  • Loading branch information
shayancanonical authored Aug 29, 2024
1 parent 27a5975 commit 472ea79
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 37 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@ jobs:
allure_on_amd64: false
- agent: 3.4.3 # 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.3 # 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
Expand All @@ -95,8 +101,9 @@ jobs:
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' }}
permissions:
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
7 changes: 3 additions & 4 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pytest = "^8.2.2"
pytest-operator = "^0.35.0"
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.2.2"
juju = "^3.5.2.0"
mysql-connector-python = "~8.0.33"
pyyaml = "^6.0.1"
tenacity = "^8.5.0"
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ async def test_database_relation(ops_test: OpsTest):
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=3,
trust=True, # Necessary after a6f1f01: Fix/endpoints as k8s services (#142)
),
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -68,7 +68,7 @@ async def test_database_relation(ops_test: OpsTest):
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=1,
trust=True,
),
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -68,14 +68,14 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
ops_test.model.deploy(
GRAFANA_AGENT_APP_NAME,
application_name=GRAFANA_AGENT_APP_NAME,
num_units=1,
series="jammy",
base="[email protected]",
channel="latest/stable",
),
)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_exporter_with_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=1,
trust=True,
),
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -84,14 +84,14 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
ops_test.model.deploy(
GRAFANA_AGENT_APP_NAME,
application_name=GRAFANA_AGENT_APP_NAME,
num_units=1,
series="jammy",
base="[email protected]",
channel="latest/stable",
),
)
Expand Down Expand Up @@ -141,7 +141,7 @@ async def test_exporter_endpoint(ops_test: OpsTest) -> None:
application_name=tls_app_name,
channel=tls_channel,
config=tls_config,
series="jammy",
base="[email protected]",
)

await ops_test.model.wait_for_idle([tls_app_name], status="active", timeout=SLOW_TIMEOUT)
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_log_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ async def test_log_rotation(ops_test: OpsTest):
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=3,
trust=True, # Necessary after a6f1f01: Fix/endpoints as k8s services (#142)
),
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -69,7 +69,7 @@ async def test_log_rotation(ops_test: OpsTest):
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
)
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/test_node_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ async def test_build_and_deploy(ops_test: OpsTest):
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=3,
trust=True, # Necessary after a6f1f01: Fix/endpoints as k8s services (#142)
),
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -78,14 +78,14 @@ async def test_build_and_deploy(ops_test: OpsTest):
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
ops_test.model.deploy(
DATA_INTEGRATOR,
channel="latest/edge",
application_name=DATA_INTEGRATOR,
series="jammy",
base="[email protected]",
config={"database-name": "test"},
num_units=1,
),
Expand All @@ -94,7 +94,7 @@ async def test_build_and_deploy(ops_test: OpsTest):
channel=tls_channel,
application_name=SELF_SIGNED_CERTIFICATE_NAME,
config=TLS_CONFIG,
series="jammy",
base="[email protected]",
num_units=1,
),
)
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def test_build_deploy_and_relate(ops_test: OpsTest) -> None:
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=1,
trust=True,
)
Expand All @@ -73,7 +73,7 @@ async def test_build_deploy_and_relate(ops_test: OpsTest) -> None:
ops_test.model.deploy(
mysqlrouter_charm,
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
resources=mysqlrouter_resources,
num_units=1,
trust=True,
Expand All @@ -83,13 +83,13 @@ async def test_build_deploy_and_relate(ops_test: OpsTest) -> None:
application_name=tls_app_name,
channel=tls_channel,
config=tls_config,
series="jammy",
base="[email protected]",
),
ops_test.model.deploy(
TEST_APP_NAME,
application_name=TEST_APP_NAME,
channel="latest/edge",
series="jammy",
base="[email protected]",
),
)

Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ async def test_deploy_edge(ops_test: OpsTest) -> None:
channel="8.0/edge",
application_name=MYSQL_APP_NAME,
config={"profile": "testing"},
series="jammy",
base="[email protected]",
num_units=1,
trust=True, # Necessary after a6f1f01: Fix/endpoints as k8s services (#142)
),
ops_test.model.deploy(
MYSQL_ROUTER_APP_NAME,
channel="8.0/edge",
application_name=MYSQL_ROUTER_APP_NAME,
series="jammy",
base="[email protected]",
num_units=3,
trust=True,
),
ops_test.model.deploy(
APPLICATION_APP_NAME,
channel="latest/edge",
application_name=APPLICATION_APP_NAME,
series="jammy",
base="[email protected]",
num_units=1,
),
)
Expand Down

0 comments on commit 472ea79

Please sign in to comment.