Skip to content

Commit

Permalink
Use juju 3 in integ tests (#143)
Browse files Browse the repository at this point in the history
* Use juju 3 in integ tests

* Change microk8s channel

* Fix tox.ini

* Fix the curl test

* Fix another run action

* Fix typo
  • Loading branch information
nrobinaubertin authored Dec 1, 2023
1 parent 549168b commit 50fe26e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ jobs:
extra-arguments: --localstack-address 172.17.0.1 -m "not (requires_secrets)"
pre-run-script: localstack-installation.sh
trivy-image-config: "trivy.yaml"
juju-channel: 3.1/stable
channel: 1.28-strict/stable
2 changes: 2 additions & 0 deletions .github/workflows/integration_test_with_secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ jobs:
extra-arguments: --localstack-address 172.17.0.1 -m "requires_secrets"
pre-run-script: localstack-installation.sh
trivy-image-config: "trivy.yaml"
juju-channel: 3.1/stable
channel: 1.28-strict/stable
12 changes: 7 additions & 5 deletions tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ async def test_prom_exporter_is_up(app: Application):
assert discourse_unit
cmd = f"/usr/bin/curl -m 30 http://localhost:{PROMETHEUS_PORT}/metrics"
action = await discourse_unit.run(cmd, timeout=60)
code = action.results.get("Code")
stdout = action.results.get("Stdout")
stderr = action.results.get("Stderr")
assert code == "0", f"{cmd} failed ({code}): {stderr or stdout}"
await action.wait()
code = action.results.get("return-code")
stdout = action.results.get("stdout")
stderr = action.results.get("stderr")
assert code == 0, f"{cmd} failed ({code}): {stderr or stdout}"


@pytest.mark.asyncio
Expand Down Expand Up @@ -96,7 +97,8 @@ async def test_s3_conf(app: Application, localstack_address: str, model: Model):
action = await app.units[0].run( # type: ignore
f'echo "{s3_conf["ip_address"]} {s3_conf["bucket"]}.s3.{s3_conf["domain"]}" >> /etc/hosts'
)
assert action.results.get("Code") == "0", "Can't inject S3 IP in Discourse hosts"
await action.wait()
assert action.results.get("return-code") == 0, "Can't inject S3 IP in Discourse hosts"

logger.info("Injected bucket subdomain in hosts, configuring settings for discourse")
# Application does actually have attribute set_config
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ deps =
flake8-docstrings-complete
flake8-test-docs
isort
juju<3.0
juju>=3.0
mypy
ops>=2.6.0
ops-lib-pgsql
Expand Down Expand Up @@ -112,7 +112,7 @@ deps =
boto3
bs4
cosl
juju<3.0
juju>=3.0
pytest
pytest-operator
pytest-asyncio
Expand Down

0 comments on commit 50fe26e

Please sign in to comment.