Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use juju 3 in integ tests #143

Merged
merged 8 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading