Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
chore: fix CI pipeline
Browse files Browse the repository at this point in the history
This will always pull from `main` when testing against `slurmctld-operator`, which is arguably better when trying to do breaking changes in integrations between the charms.
  • Loading branch information
jedel1043 authored and NucciTheBoss committed Jul 17, 2024
1 parent f0102f2 commit d004814
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 52 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
fail-fast: true
matrix:
bases:
bases:
- [email protected]
name: Integration tests (LXD) | ${{ matrix.bases }}
runs-on: ubuntu-latest
Expand All @@ -79,10 +79,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: main
- name: Fetch slurmctld
uses: actions/checkout@v4
with:
repository: charmed-hpc/slurmctld-operator
path: slurmctld-operator
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
juju-channel: 3.1/stable
- name: Run tests
run: tox run -e integration -- --charm-base=${{ matrix.bases }}
run: cd main && tox run -e integration -- --charm-base=${{ matrix.bases }} --use-local
20 changes: 0 additions & 20 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,3 @@ async def slurmctld_charm(request, ops_test: OpsTest) -> Union[str, Path]:
)

return "slurmctld"


@pytest.fixture(scope="module")
async def slurmdbd_charm(request, ops_test: OpsTest) -> Union[str, Path]:
"""Pack slurmdbd charm to use for integration tests when --use-local is specified.
Returns:
`str` "slurmdbd" if --use-local not specified or if SLURMDBD_DIR does not exist.
"""
if request.config.option.use_local:
logger.info("Using local slurmdbd operator rather than pulling from Charmhub")
if SLURMDBD_DIR.exists():
return await ops_test.build_charm(SLURMDBD_DIR)
else:
logger.warning(
f"{SLURMDBD_DIR} not found. "
f"Defaulting to latest/edge slurmdbd operator from Charmhub"
)

return "slurmdbd"
32 changes: 3 additions & 29 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@
@pytest.mark.skip_if_deployed
@pytest.mark.order(1)
async def test_build_and_deploy(
ops_test: OpsTest, charm_base: str, slurmd_charm, slurmctld_charm, slurmdbd_charm
ops_test: OpsTest, charm_base: str, slurmd_charm, slurmctld_charm
) -> None:
"""Test that the slurmd charm can stabilize against slurmctld, slurmdbd and MySQL."""
logger.info(f"Deploying {SLURMD} against {SLURMCTLD}, {SLURMDBD}, and {DATABASE}")
logger.info(f"Deploying {SLURMD} against {SLURMCTLD}")
# Pack charms and download NHC resource for slurmd operator.
slurmd, slurmctld, slurmdbd = await asyncio.gather(
slurmd_charm, slurmctld_charm, slurmdbd_charm
)
slurmd, slurmctld = await asyncio.gather(slurmd_charm, slurmctld_charm)
# Deploy the test Charmed SLURM cloud.
await asyncio.gather(
ops_test.model.deploy(
Expand All @@ -58,33 +56,9 @@ async def test_build_and_deploy(
num_units=1,
base=charm_base,
),
ops_test.model.deploy(
str(slurmdbd),
application_name=SLURMDBD,
channel="edge" if isinstance(slurmdbd, str) else None,
num_units=1,
base=charm_base,
),
ops_test.model.deploy(
ROUTER,
application_name=f"{SLURMDBD}-{ROUTER}",
channel="dpe/edge",
num_units=0,
base=charm_base,
),
ops_test.model.deploy(
DATABASE,
application_name=DATABASE,
channel="8.0/edge",
num_units=1,
base="[email protected]",
),
)
# Set relations for charmed applications.
await ops_test.model.integrate(f"{SLURMD}:{SLURMCTLD}", f"{SLURMCTLD}:{SLURMD}")
await ops_test.model.integrate(f"{SLURMDBD}:{SLURMCTLD}", f"{SLURMCTLD}:{SLURMDBD}")
await ops_test.model.integrate(f"{SLURMDBD}-{ROUTER}:backend-database", f"{DATABASE}:database")
await ops_test.model.integrate(f"{SLURMDBD}:database", f"{SLURMDBD}-{ROUTER}:database")
# 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=[SLURMD], status="active", timeout=1000)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ commands =
-s \
--tb native \
--log-cli-level=INFO \
{[vars]tst_path}integration \
{[vars]tst_path}/integration \
{posargs}

0 comments on commit d004814

Please sign in to comment.