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

Add Juju 3.4 support #52

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 8 additions & 10 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
- '**.md'
- '**.rst'

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

jobs:
lint-unit:
uses: canonical/bootstack-actions/.github/workflows/lint-unit.yaml@v2
Expand All @@ -19,26 +23,20 @@ jobs:
python-version: ['3.8', '3.10']
with:
python-version: ${{ matrix.python-version }}
tox-version: '<4'

func:
uses: canonical/bootstack-actions/.github/workflows/func.yaml@v2
needs: lint-unit
strategy:
fail-fast: false
matrix:
include:
- juju-channel: '2.9/stable'
command: 'make functional'
- juju-channel: '3.3/stable'
command: 'make functional33-jammy'
- juju-channel: '3.3/stable'
command: 'make functional33-focal'
juju-channel: ['3.4/stable']
command: ['TEST_JUJU3=1 make functional']

with:
command: ${{ matrix.command }}
command: TEST_JUJU_CHANNEL=${{ matrix.juju-channel }} ${{ matrix.command }}
juju-channel: ${{ matrix.juju-channel }}
nested-containers: true
provider: 'lxd'
python-version: '3.10'
timeout-minutes: 120
tox-version: '<4'
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ help:
@echo " make reformat - run lint tools to auto format code"
@echo " make unittests - run the tests defined in the unittest subdirectory"
@echo " make functional - run the tests defined in the functional subdirectory"
@echo " make functional33 - run the tests defined in the functional subdirectory with juju 3.3 requirements"
@echo " make test - run lint, unittests and functional targets"
@echo ""

Expand Down Expand Up @@ -77,14 +76,6 @@ functional: build
@echo "Executing functional tests using built charm at ${PROJECTPATH}"
@CHARM_LOCATION=${PROJECTPATH} tox -e func -- ${FUNC_ARGS}

functional33-jammy: build
@echo "Executing functional tests using built charm at ${PROJECTPATH} with juju 3.3 requirements"
@CHARM_LOCATION=${PROJECTPATH} tox -e func33-jammy -- ${FUNC_ARGS}

functional33-focal: build
@echo "Executing functional tests using built charm at ${PROJECTPATH} with juju 3.3 requirements"
@CHARM_LOCATION=${PROJECTPATH} tox -e func33-focal -- ${FUNC_ARGS}

test: lint unittests functional
@echo "Tests completed for charm ${CHARM_NAME}."

Expand Down
12 changes: 10 additions & 2 deletions tests/functional/tests/bundles/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ applications:
charm: ch:ubuntu
num_units: 1

prometheus-juju-exporter:
charm: prometheus-juju-exporter
num_units: 0

juju-local:
charm: bootstack-charmers-juju-local
num_units: 0
Expand All @@ -12,5 +16,9 @@ applications:
num_units: 1

relations:
- - "ubuntu"
- "juju-local"
- - ubuntu
- juju-local
- - ubuntu
- prometheus-juju-exporter
- - prometheus
- prometheus-juju-exporter
1 change: 0 additions & 1 deletion tests/functional/tests/bundles/bionic.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions tests/functional/tests/bundles/overlays/bionic.yaml.j2

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
applications:
{{ charm_name }}:
charm: "{{ CHARM_LOCATION }}/{{ charm_name }}.charm"
num_units: 0
juju-local:
options:
juju-channel: {{ TEST_JUJU_CHANNEL }}

relations:
- - "ubuntu"
- {{ charm_name }}
- - "prometheus"
- {{ charm_name }}
2 changes: 1 addition & 1 deletion tests/functional/tests/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def add_machines(self, count: int, timeout: int = 600) -> None:

@tenacity.retry(
wait=tenacity.wait_fixed(5),
stop=tenacity.stop_after_attempt(12),
stop=tenacity.stop_after_attempt(24),
rgildein marked this conversation as resolved.
Show resolved Hide resolved
)
def validate_exporter(self, expected_machine_count: int = 1) -> None:
"""Verify that exporter exposes expected data on '/metrics' endpoint.
Expand Down
1 change: 0 additions & 1 deletion tests/functional/tests/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ charm_name: prometheus-juju-exporter
gate_bundles:
- jammy
- focal
- bionic

tests:
- tests.test_charm.BasicPrometheusJujuExporterTests
Expand Down
33 changes: 3 additions & 30 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ passenv =
SNAP_HTTP_PROXY
SNAP_HTTPS_PROXY
OS_*
TEST_*

[testenv:dev-environment]
envdir = {toxinidir}/.venv
Expand Down Expand Up @@ -77,36 +78,8 @@ deps =
pytest-cov

[testenv:func]
setenv =
TEST_JUJU_CHANNEL = 2.9/stable
changedir = {toxinidir}/tests/functional
commands = functest-run-suite
deps =
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
-r {toxinidir}/tests/functional/requirements.txt

[testenv:func33-jammy]
setenv =
TEST_JUJU_CHANNEL = 3.3/stable
changedir = {toxinidir}/tests/functional
commands =
# NOTE(mertkirpici): functest-run-suite -b jammy focal
# or functest-run-suite -b jammy -b focal does not work
# https://github.com/openstack-charmers/zaza/issues/614
functest-run-suite -b jammy
deps =
git+https://github.com/openstack-charmers/[email protected]#egg=zaza[juju-33]
-r {toxinidir}/tests/functional/requirements.txt

[testenv:func33-focal]
setenv =
TEST_JUJU_CHANNEL = 3.3/stable
changedir = {toxinidir}/tests/functional
commands =
# NOTE(mertkirpici): functest-run-suite -b jammy focal
# or functest-run-suite -b jammy -b focal does not work
# https://github.com/openstack-charmers/zaza/issues/614
functest-run-suite -b focal
commands = functest-run-suite {posargs:--keep-faulty-model}
deps =
git+https://github.com/openstack-charmers/zaza.git@libjuju-3.1#egg=zaza[juju-33]
git+https://github.com/openstack-charmers/zaza.git@master#egg=zaza
-r {toxinidir}/tests/functional/requirements.txt
Loading