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

Commit

Permalink
Merge pull request #5 from canonical/dev
Browse files Browse the repository at this point in the history
bugfix: Fix integration tests
  • Loading branch information
jaimesouza authored Mar 23, 2023
2 parents ed550b6 + bab679e commit 5e6cb2c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 25 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: woke
uses: get-woke/woke-action@v0
with:
Expand Down Expand Up @@ -67,7 +66,6 @@ jobs:
uses: charmed-kubernetes/actions-operator@main
with:
provider: lxd
# Juju channel should eventually be updated to 3.0/stable
juju-channel: 2.9/stable
juju-channel: 3.1/stable
- name: Run tests
run: tox -e integration
1 change: 0 additions & 1 deletion tests/integration/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
# Copyright 2023 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
38 changes: 19 additions & 19 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
SLURMD = "slurmd"
SLURMDBD = "slurmdbd"
SLURMRESTD = "slurmrestd"
DATABASE = "mysql"
ROUTER = "mysql-router"


@pytest.mark.abort_on_fail
Expand Down Expand Up @@ -76,31 +78,29 @@ async def test_build_and_deploy(
series=series,
),
ops_test.model.deploy(
"percona-cluster",
application_name="mysql",
ROUTER,
application_name=f"{SLURMDBD}-{ROUTER}",
channel="dpe/edge",
num_units=1,
series=series,
),
ops_test.model.deploy(
DATABASE,
application_name=DATABASE,
channel="edge",
num_units=1,
series="bionic",
series="jammy",
),
)
# Attach ETCD resource to the slurmctld controller
# Attach resources to charms.
await ops_test.juju("attach-resource", SLURMCTLD, f"etcd={res_slurmctld['etcd']}")

# Add slurmdbd relation to slurmctld
await ops_test.model.relate(SLURMCTLD, SLURMDBD)

# Add mysql relation to slurmdbd
await ops_test.model.relate(SLURMDBD, "mysql")

# Add slurmctld relation to slurmrestd
await ops_test.model.relate(SLURMRESTD, SLURMCTLD)

# Attach NHC resource to the slurmd controller
await ops_test.juju("attach-resource", SLURMD, f"nhc={res_slurmd['nhc']}")

# Add slurmctld relation to slurmd
await ops_test.model.add_relation(SLURMD, SLURMCTLD)

# Set relations for charmed applications.
await ops_test.model.relate(f"{SLURMCTLD}:{SLURMDBD}", f"{SLURMDBD}:{SLURMDBD}")
await ops_test.model.relate(f"{SLURMDBD}-{ROUTER}:backend-database", f"{DATABASE}:database")
await ops_test.model.relate(f"{SLURMDBD}:database", f"{SLURMDBD}-{ROUTER}:database")
await ops_test.model.relate(f"{SLURMRESTD}:slurmrestd", f"{SLURMCTLD}:slurmrestd")
await ops_test.model.add_relation(f"{SLURMD}:{SLURMD}", f"{SLURMCTLD}:{SLURMD}")
# 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)
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ commands =
[testenv:integration]
description = Run integration tests
deps =
juju==3.1.0.1
pytest==7.2.0
juju==3.0.4
pytest-operator==0.22.0
requests==2.28.1
tenacity==8.1.0
commands =
pytest -v \
Expand Down

0 comments on commit 5e6cb2c

Please sign in to comment.