Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

grafana: Rename fixtures to contain Grafana versions.

Alex Vandiver18067794aea7
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index 15968750d4d..2acf711171c 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -758,7 +758,7 @@ DOC_SCREENSHOT_CONFIG: Dict[str, List[BaseScreenshotConfig]] = {
"gocd": [ScreenshotConfig("pipeline.json")],
"gogs": [ScreenshotConfig("pull_request__opened.json")],
"gosquared": [ScreenshotConfig("traffic_spike.json", image_name="000.png")],
- "grafana": [ScreenshotConfig("alert.json")],
+ "grafana": [ScreenshotConfig("alert_v7.json")],
"greenhouse": [ScreenshotConfig("candidate_stage_change.json", image_name="000.png")],
"groove": [ScreenshotConfig("ticket_started.json")],
"harbor": [ScreenshotConfig("scanning_completed.json")],
diff --git a/zerver/webhooks/grafana/fixtures/alert_new_multiple.json b/zerver/webhooks/grafana/fixtures/alert_multiple_v8.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert_new_multiple.json
rename to zerver/webhooks/grafana/fixtures/alert_multiple_v8.json
diff --git a/zerver/webhooks/grafana/fixtures/alert_ok.json b/zerver/webhooks/grafana/fixtures/alert_ok_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert_ok.json
rename to zerver/webhooks/grafana/fixtures/alert_ok_v7.json
diff --git a/zerver/webhooks/grafana/fixtures/alert_paused.json b/zerver/webhooks/grafana/fixtures/alert_paused_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert_paused.json
rename to zerver/webhooks/grafana/fixtures/alert_paused_v7.json
diff --git a/zerver/webhooks/grafana/fixtures/alert_pending.json b/zerver/webhooks/grafana/fixtures/alert_pending_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert_pending.json
rename to zerver/webhooks/grafana/fixtures/alert_pending_v7.json
diff --git a/zerver/webhooks/grafana/fixtures/alert.json b/zerver/webhooks/grafana/fixtures/alert_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert.json
rename to zerver/webhooks/grafana/fixtures/alert_v7.json
diff --git a/zerver/webhooks/grafana/fixtures/alert_new.json b/zerver/webhooks/grafana/fixtures/alert_v8.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/alert_new.json
rename to zerver/webhooks/grafana/fixtures/alert_v8.json
diff --git a/zerver/webhooks/grafana/fixtures/no_data_alert.json b/zerver/webhooks/grafana/fixtures/no_data_alert_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/no_data_alert.json
rename to zerver/webhooks/grafana/fixtures/no_data_alert_v7.json
diff --git a/zerver/webhooks/grafana/fixtures/no_message_alert.json b/zerver/webhooks/grafana/fixtures/no_message_alert_v7.json
similarity index 100%
rename from zerver/webhooks/grafana/fixtures/no_message_alert.json
rename to zerver/webhooks/grafana/fixtures/no_message_alert_v7.json
diff --git a/zerver/webhooks/grafana/tests.py b/zerver/webhooks/grafana/tests.py
index 803441521cf..e1d7c17ed88 100644
--- a/zerver/webhooks/grafana/tests.py
+++ b/zerver/webhooks/grafana/tests.py
@@ -6,8 +6,7 @@ class GrafanaHookTests(WebhookTestCase):
URL_TEMPLATE = "/api/v1/external/grafana?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "grafana"
- # Note: Include a test function per each distinct message condition your integration supports
- def test_alert(self) -> None:
+ def test_alert_v7(self) -> None:
expected_topic_name = "[Alerting] Test notification"
expected_message = """
:alert: **ALERTING**
@@ -22,15 +21,14 @@ Someone is testing the alert notification within grafana.
[Click to view visualization](https://grafana.com/assets/img/blog/mixed_styles.png)
""".strip()
- # use fixture named helloworld_hello
self.check_webhook(
- "alert",
+ "alert_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- def test_no_data_alert(self) -> None:
+ def test_no_data_alert_v7(self) -> None:
expected_topic_name = "[Alerting] No Data alert"
expected_message = """
:alert: **ALERTING**
@@ -41,15 +39,14 @@ The panel has no data.
""".strip()
- # use fixture named helloworld_hello
self.check_webhook(
- "no_data_alert",
+ "no_data_alert_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- def test_no_message_alert(self) -> None:
+ def test_no_message_alert_v7(self) -> None:
expected_topic_name = "[Alerting] No Message alert"
expected_message = """
:alert: **ALERTING**
@@ -59,16 +56,14 @@ The panel has no data.
**A-series:** 21.573108436586445
""".strip()
- # use fixture named helloworld_hello
self.check_webhook(
- "no_message_alert",
+ "no_message_alert_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- # Note: Include a test function per each distinct message condition your integration supports
- def test_alert_ok(self) -> None:
+ def test_alert_ok_v7(self) -> None:
expected_topic_name = "[Ok] Test notification"
expected_message = """
:squared_ok: **OK**
@@ -82,16 +77,14 @@ Someone is testing the alert notification within grafana.
[Click to view visualization](https://grafana.com/assets/img/blog/mixed_styles.png)
""".strip()
- # use fixture named helloworld_hello
self.check_webhook(
- "alert_ok",
+ "alert_ok_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- # Note: Include a test function per each distinct message condition your integration supports
- def test_alert_paused(self) -> None:
+ def test_alert_paused_v7(self) -> None:
expected_topic_name = "[Paused] Test notification"
expected_message = """
:info: **PAUSED**
@@ -104,16 +97,14 @@ Someone is testing the alert notification within grafana.
[Click to view visualization](https://grafana.com/assets/img/blog/mixed_styles.png)
""".strip()
- # use fixture named helloworld_hello
self.check_webhook(
- "alert_paused",
+ "alert_paused_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- # Note: Include a test function per each distinct message condition your integration supports
- def test_alert_pending(self) -> None:
+ def test_alert_pending_v7(self) -> None:
expected_topic_name = "[Pending] Test notification"
expected_message = """
:info: **PENDING**
@@ -130,13 +121,13 @@ Someone is testing the alert notification within grafana.
# use fixture named helloworld_hello
self.check_webhook(
- "alert_pending",
+ "alert_pending_v7",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- def test_alert_new(self) -> None:
+ def test_alert_v8(self) -> None:
expected_topic_name = "[RESOLVED:1]"
expected_message = """
:checkbox: **RESOLVED**
@@ -161,13 +152,13 @@ Annotations:
""".strip()
self.check_webhook(
- "alert_new",
+ "alert_v8",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
- def test_alert_new_multiple(self) -> None:
+ def test_alert_multiple_v8(self) -> None:
expected_topic_name = "[FIRING:2]"
expected_message = """
:alert: **FIRING**
@@ -205,7 +196,7 @@ Annotations:
""".strip()
self.check_webhook(
- "alert_new_multiple",
+ "alert_multiple_v8",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",