From 9d0322b79cfd00337661ad20c7a44c5fe7b2757f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Juli=C3=A1n=20Espina?= Date: Wed, 17 Jul 2024 17:32:03 -0600 Subject: [PATCH] ci: fix CI pipeline --- .github/workflows/ci.yaml | 31 ++++++++++++++++++++++++++----- .github/workflows/release.yaml | 4 ++-- tests/integration/test_charm.py | 9 ++++----- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e2c006..ef4cbdc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,12 +65,16 @@ jobs: integration-test: strategy: - fail-fast: true + fail-fast: false matrix: - bases: + bases: - ubuntu@22.04 - name: Integration tests (LXD) | ${{ matrix.bases }} + local: [true, false] + name: Integration tests (LXD) ${{ matrix.local && '|' || '| Charmhub (edge) |'}} ${{ matrix.bases }} runs-on: ubuntu-latest + # Testing against Charmhub will probably yield errors when doing breaking changes, so don't + # block CI on that. + continue-on-error: ${{ !matrix.local }} needs: - inclusive-naming-check - lint @@ -79,10 +83,27 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + path: main + - name: Fetch slurmctld + uses: actions/checkout@v4 + if: ${{ matrix.local }} + with: + repository: charmed-hpc/slurmctld-operator + path: slurmctld-operator + - name: Fetch slurmdbd + uses: actions/checkout@v4 + if: ${{ matrix.local }} + with: + repository: charmed-hpc/slurmdbd-operator + path: slurmdbd-operator - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: provider: lxd - juju-channel: 3.1/stable + juju-channel: 3.4/stable - name: Run tests - run: tox run -e integration -- --charm-base=${{ matrix.bases }} + run: | + cd main && tox run -e integration -- \ + --charm-base=${{ matrix.bases }} \ + ${{ matrix.local && '--use-local' || '' }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dc0a8a2..f060d34 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,10 +32,10 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Select charmhub channel - uses: canonical/charming-actions/channel@2.2.0 + uses: canonical/charming-actions/channel@2.5.0-rc id: channel - name: Upload charm to charmhub - uses: canonical/charming-actions/upload-charm@2.2.0 + uses: canonical/charming-actions/upload-charm@2.5.0-rc with: credentials: "${{ secrets.CHARMCRAFT_AUTH }}" github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index ae19444..edcf629 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -24,12 +24,11 @@ logger = logging.getLogger(__name__) +SLURMRESTD = "slurmrestd" SLURMCTLD = "slurmctld" SLURMDBD = "slurmdbd" -SLURMRESTD = "slurmrestd" DATABASE = "mysql" ROUTER = "mysql-router" -UNIT_NAME = f"{SLURMRESTD}/0" @pytest.mark.abort_on_fail @@ -93,7 +92,7 @@ async def test_build_and_deploy( # Reduce the update status frequency to accelerate the triggering of deferred events. async with ops_test.fast_forward(): await ops_test.model.wait_for_idle(apps=[SLURMRESTD], status="active", timeout=1000) - assert ops_test.model.units.get(UNIT_NAME).workload_status == "active" + assert ops_test.model.applications[SLURMRESTD].units[0].workload_status == "active" @pytest.mark.abort_on_fail @@ -106,7 +105,7 @@ async def test_build_and_deploy( async def test_munge_is_active(ops_test: OpsTest) -> None: """Test that munge is active.""" logger.info("Checking that munge is active inside Juju unit") - slurmrestd_unit = ops_test.model.units.get(UNIT_NAME) + slurmrestd_unit = ops_test.model.applications[SLURMRESTD].units[0] res = (await slurmrestd_unit.ssh("systemctl is-active munge")).strip("\n") assert res == "active" @@ -121,6 +120,6 @@ async def test_munge_is_active(ops_test: OpsTest) -> None: async def test_slurmrestd_is_active(ops_test: OpsTest) -> None: """Test that slurmrestd is active.""" logger.info("Checking that slurmrestd is active inside Juju unit") - slurmrestd_unit = ops_test.model.units.get(UNIT_NAME) + slurmrestd_unit = ops_test.model.applications[SLURMRESTD].units[0] cmd_res = (await slurmrestd_unit.ssh("systemctl is-active slurmrestd")).strip("\n") assert cmd_res == "active"