From 15bb322199a265dd40c6a56e20583a199b5ea3b2 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Thu, 4 Jul 2024 13:51:36 +0200 Subject: [PATCH 1/2] Chore: Fix `test_connect_non_json_response` by making it more lenient --- tests/test_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_core.py b/tests/test_core.py index 541dece..ea097fb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -65,4 +65,4 @@ def test_connect_non_json_response(): wtf = GrafanaWtf("https://example.org/") with pytest.raises(ConnectionError) as ex: _ = wtf.health - assert ex.match("The request to https://example.org/api/health failed: Client Error 404") + assert ex.match("The request to https://example.org/api/health failed") From 1a50d60681a7b0b75fee8b9b81fa027cf711244f Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Thu, 4 Jul 2024 13:45:54 +0200 Subject: [PATCH 2/2] CI: Verify support for Grafana 11 --- .github/workflows/tests.yml | 2 +- CHANGES.rst | 1 + README.rst | 2 +- grafana_wtf/core.py | 6 +++++- tests/.env | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4b26ee..9c21a9e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: matrix: os: [ "ubuntu-latest" ] python-version: [ "3.8", "3.12" ] - grafana-version: [ "6.7.6", "7.5.17", "8.5.27", "9.5.18", "10.3.5", "10.4.1" ] + grafana-version: [ "6.7.6", "7.5.17", "8.5.27", "9.5.18", "10.3.5", "10.4.1", "11.1.0" ] env: OS_TYPE: ${{ matrix.os }} diff --git a/CHANGES.rst b/CHANGES.rst index e5f1501..5eb1b16 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ grafana-wtf changelog in progress =========== +- CI: Verify support for Grafana 11 2024-04-20 0.19.1 ================= diff --git a/README.rst b/README.rst index 62ea8f4..04fc04c 100644 --- a/README.rst +++ b/README.rst @@ -31,7 +31,7 @@ grafana-wtf .. |license| image:: https://img.shields.io/pypi/l/grafana-wtf.svg :target: https://github.com/panodata/grafana-wtf/blob/main/LICENSE -.. |grafana-versions| image:: https://img.shields.io/badge/Grafana-6.x%20--%2010.x-blue.svg +.. |grafana-versions| image:: https://img.shields.io/badge/Grafana-6.x%20--%2011.x-blue.svg :target: https://github.com/grafana/grafana :alt: Supported Grafana versions diff --git a/grafana_wtf/core.py b/grafana_wtf/core.py index ccead1e..74afe07 100644 --- a/grafana_wtf/core.py +++ b/grafana_wtf/core.py @@ -19,6 +19,7 @@ from tqdm import tqdm from tqdm.contrib.logging import tqdm_logging_redirect from urllib3.exceptions import InsecureRequestWarning +from verlib2 import Version from grafana_wtf import __appname__, __version__ from grafana_wtf.compat import CachedSession @@ -167,7 +168,10 @@ def scan_snapshots(self): self.data.snapshots = self.grafana.snapshots.get_dashboard_snapshots() def scan_notifications(self): - self.data.notifications = self.grafana.notifications.lookup_channels() + if Version(self.grafana.version) < Version("11"): + self.data.notifications = self.grafana.notifications.lookup_channels() + else: + warnings.warn("Notification channel scanning support for Grafana 11 is not implemented yet", UserWarning) def scan_datasources(self): log.info("Scanning datasources") diff --git a/tests/.env b/tests/.env index d15fe3b..02cc723 100644 --- a/tests/.env +++ b/tests/.env @@ -4,4 +4,5 @@ #GRAFANA_VERSION=9.5.18 #GRAFANA_VERSION=10.1.9 #GRAFANA_VERSION=10.3.5 -GRAFANA_VERSION=10.4.1 +#GRAFANA_VERSION=10.4.1 +GRAFANA_VERSION=11.1.0