Skip to content

Commit

Permalink
test that prometheus doesn't fail with the same charm related twice. (#…
Browse files Browse the repository at this point in the history
…317)

* test that prometheus doesn't fail with the same charm related twice.

* use reset config in case the default changes

* specify the relation explicitly
  • Loading branch information
dstathis authored Jun 27, 2022
1 parent 0851420 commit 0055756
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/integration/test_deduplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,20 @@ async def test_multiple_scrape_jobs_in_constructor(
targets = await get_prometheus_active_targets(ops_test, prometheus_app_name)
# Two unique jobs above plus an additional an additional job for self scraping.
assert len(targets) == 3


async def test_same_app_related_two_ways(
ops_test: OpsTest, prometheus_charm, prometheus_tester_charm
):
"""Test that the deduplication works when the same app is related twice."""
await asyncio.gather(
ops_test.model.applications[tester_app_name].reset_config(["scrape_jobs"]),
ops_test.model.deploy(
"prometheus-scrape-config-k8s", channel="edge", application_name="scrape-config"
),
)
await asyncio.gather(
ops_test.model.add_relation(prometheus_app_name, "scrape-config:metrics-endpoint"),
ops_test.model.add_relation("scrape-config", tester_app_name),
)
await ops_test.model.wait_for_idle(status="active")

0 comments on commit 0055756

Please sign in to comment.