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

Add itest for multi unit alerts #21

Merged
merged 5 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 4 additions & 1 deletion bundle.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ applications:
{%- if testing %}
avalanche:
charm: {{ avalanche|default('avalanche-k8s', true) }}
scale: 1
scale: 2
trust: true
{%- if avalanche is defined and avalanche.endswith('.charm') %}
resources:
avalanche-image: "quay.io/freshtracks.io/avalanche"
{%- else %}
channel: {{ channel|default('edge', true) }}
{%- endif %}
options:
metric_count: 10
series_count: 2
{%- endif %}

relations:
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/test_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ async def test_alerts_are_grouped(ops_test):

assert i >= 0 # should have at least one group listed (the "AlwaysFiring" alarm rule)
log.info("juju topology grouping test passed for %s groups", i + 1)


async def test_alerts_are_fired_from_non_leader_units_too(ops_test):
"""The list of alerts must include an "AlwaysFiring" alert from each avalanche unit."""
alerts = await get_alertmanager_alerts(ops_test, "alertmanager", 0, retries=100)

alerts = list(
filter(lambda itm: itm["labels"]["alertname"] == "AlwaysFiringDueToNumericValue", alerts)
)
units_firing = sorted([alert["labels"]["juju_unit"] for alert in alerts])
assert units_firing == ["avalanche/0", "avalanche/1"]