Skip to content

Commit

Permalink
fix: kfp-api observability integration tests (#86)
Browse files Browse the repository at this point in the history
Fixed tests that were broken due to ambiguous relations
  • Loading branch information
ca-scribner authored and DnPlas committed Aug 2, 2022
1 parent ebcd837 commit 27ccb3b
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions charms/kfp-api/tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,26 @@ async def test_prometheus_grafana_integration(ops_test: OpsTest):
"""Deploy prometheus, grafana and required relations, then test the metrics."""
prometheus = "prometheus-k8s"
grafana = "grafana-k8s"
prometheus_scrape_charm = "prometheus-scrape-config-k8s"
scrape_config = {"scrape_interval": "5s"}
prometheus_scrape = "prometheus-scrape-config-k8s"
scrape_config = {"scrape_interval": "30s"}

await ops_test.model.deploy(prometheus, channel="latest/beta")
await ops_test.model.deploy(grafana, channel="latest/beta")
await ops_test.model.add_relation(prometheus, grafana)
await ops_test.model.add_relation(APP_NAME, grafana)
await ops_test.model.deploy(
prometheus_scrape_charm,
channel="latest/beta",
config=scrape_config)
await ops_test.model.add_relation(APP_NAME, prometheus_scrape_charm)
await ops_test.model.add_relation(prometheus, prometheus_scrape_charm)
# Deploy and relate prometheus
await ops_test.model.deploy(prometheus, channel="latest/edge", trust=True)
await ops_test.model.deploy(grafana, channel="latest/edge", trust=True)
await ops_test.model.deploy(prometheus_scrape, channel="latest/beta", config=scrape_config)

await ops_test.model.add_relation(APP_NAME, prometheus_scrape)
await ops_test.model.add_relation(
f"{prometheus}:grafana-dashboard", f"{grafana}:grafana-dashboard"
)
await ops_test.model.add_relation(
f"{APP_NAME}:grafana-dashboard", f"{grafana}:grafana-dashboard"
)
await ops_test.model.add_relation(
f"{prometheus}:metrics-endpoint", f"{prometheus_scrape}:metrics-endpoint"
)

await ops_test.model.wait_for_idle(status="active", timeout=60 * 15)
await ops_test.model.wait_for_idle(status="active", timeout=60 * 20)

status = await ops_test.model.get_status()
prometheus_unit_ip = status["applications"][prometheus]["units"][f"{prometheus}/0"]["address"]
Expand Down

0 comments on commit 27ccb3b

Please sign in to comment.