From 380e394e5ac8cce6b2e6f4d34ab81a08428622dc Mon Sep 17 00:00:00 2001 From: Seyeong Kim Date: Tue, 18 Jun 2024 01:02:22 +0000 Subject: [PATCH] Add support 18.04 - Add 18.04 to charmcraft - Change dependency libjuju to <3.0 to support bionic - Change github ci to support juju 2.9 - fixed ruff issue Signed-off-by: Seyeong Kim --- .github/workflows/ci.yaml | 7 ++++--- charmcraft.yaml | 16 ++++++++++++++++ requirements.txt | 3 ++- tests/integration/conftest.py | 2 ++ tests/integration/test_charm.py | 4 ++-- tox.ini | 5 +++-- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a693ab3..f95e858 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -68,8 +68,9 @@ jobs: fail-fast: true matrix: bases: - - ubuntu@20.04 - - ubuntu@22.04 + - bionic + - focal + - jammy name: Integration tests (LXD) | ${{ matrix.bases }} runs-on: ubuntu-latest needs: @@ -83,6 +84,6 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: lxd - juju-channel: 3/stable + juju-channel: 2.9/stable - name: Run tests run: tox run -e integration -- --charm-base=${{ matrix.bases }} diff --git a/charmcraft.yaml b/charmcraft.yaml index 39a087b..eea5eac 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -58,3 +58,19 @@ bases: - name: "ubuntu" channel: "20.04" architectures: [arm64] + - build-on: + - name: "ubuntu" + channel: "20.04" + architectures: [amd64] + run-on: + - name: "ubuntu" + channel: "18.04" + architectures: [amd64] + - build-on: + - name: "ubuntu" + channel: "20.04" + architectures: [arm64] + run-on: + - name: "ubuntu" + channel: "18.04" + architectures: [arm64] diff --git a/requirements.txt b/requirements.txt index 96faf88..4919449 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -ops >= 1.4.0 +ops >= 1.4.0, <= 1.5.5 +websocket_client <= 1.6.4 diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 1349950..3f3bcd9 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -45,6 +45,8 @@ def pytest_addoption(parser) -> None: @pytest.fixture(scope="module") def charm_base(request) -> str: """Get the lldp charm base to use.""" + #if request.config.option.charm_base == "ubuntu@18.04": + # return "bionic" return request.config.option.charm_base diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index 44625c6..d0290f7 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -55,8 +55,8 @@ async def test_build_and_deploy( ), ) - # Integrate lldpd with ubuntu - await ops_test.model.integrate("ubuntu:juju-info", "lldpd:juju-info") + # Relate lldpd with ubuntu + await ops_test.model.relate("ubuntu:juju-info", "lldpd:juju-info") async with ops_test.fast_forward(): await ops_test.model.wait_for_idle( apps=["lldpd", "ubuntu"], status="active", timeout=1800 diff --git a/tox.ini b/tox.ini index 17b5573..c962347 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ deps = codespell commands = codespell --skip .git --skip .tox --skip build --skip lib --skip venv --skip .mypy_cache {toxinidir} - ruff {[vars]all_path} + ruff check {[vars]all_path} black --check --diff {[vars]all_path} [testenv:static-{charm,lib}] @@ -74,9 +74,10 @@ commands = coverage report [testenv:integration] +# To support bionic, juju should be below libjuju 3.0 description = Run integration tests deps = - juju<=3.3.0,>=3.0 + juju < 3.0.0 pytest pytest-operator pytest-order