Skip to content

Commit

Permalink
Fix integration test (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhdaze authored Jul 22, 2024
1 parent e46d08f commit 2e0ae76
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/integration/test_cos_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ async def test_alerts(ops_test: OpsTest, lxd_model, k8s_model):
await _disable_hardware_exporter(ops_test, lxd_model)
await _export_mock_metrics(lxd_model)

model_name = ops_test.model_name

model_status = await k8s_model.get_status()
traefik_ip = model_status["applications"]["traefik"].public_address

prometheus_alerts_endpoint = f"http://{traefik_ip}/{model_name}-prometheus-0/api/v1/alerts"
# Run juju action to get the ip address that traefik is configured to serve on
returncode, stdout, stderr = await ops_test.run(
"juju",
"run",
"--format",
"json",
"traefik/0",
"show-proxied-endpoints",
)
json_data = json.loads(stdout)
proxied_endpoints = json.loads(json_data["traefik/0"]["results"]["proxied-endpoints"])
prometheus_url = proxied_endpoints["prometheus/0"]["url"]
prometheus_alerts_endpoint = f"{prometheus_url}/api/v1/alerts"

cmd = ["curl", prometheus_alerts_endpoint]

Expand Down

0 comments on commit 2e0ae76

Please sign in to comment.