Skip to content

Commit 9240856

Browse files
committed
Fix compatibility with Grafana >= 12.x
1 parent 95f878f commit 9240856

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ grafana-wtf changelog
66
in progress
77
===========
88
- Fixed ``grafana-wtf log`` subcommand for Grafana >= 11.6.0.
9+
- Fixed compatibility with Grafana >= 12.x.
910

1011
2025-07-28 0.23.2
1112
=================

tests/test_commands.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,14 @@ def test_log_tabular_success(ldi_resources, capsys, caplog):
374374
assert 'Aggregating edit history for Grafana dashboard "ioUrPwQiz"' in caplog.text
375375

376376
reference = """
377-
| Notes: n/a<br/>[Testdrive » luftdaten.info generic trend v27](http://localhost:33333/d/ioUrPwQiz/luftdaten-info-generic-trend-v27) | User: admin<br/>Date: xxxx-xx-xxTxx:xx:xxZ |
377+
[Testdrive » luftdaten.info generic trend v27](http://localhost:33333/d/ioUrPwQiz/luftdaten-info-generic-trend-v27) | User: admin<br/>Date: xxxx-xx-xxTxx:xx:xxZ |
378378
""".strip() # noqa: E501
379379

380380
first_item_raw = str.splitlines(captured.out)[-1]
381381
first_item_normalized = re.sub( # noqa: B034
382-
"(.*)Date: .+|(.*)", r"\1Date: xxxx-xx-xxTxx:xx:xxZ |\2", first_item_raw, 1
382+
"(.*)Date: .+|(.*)", r"\1Date: xxxx-xx-xxTxx:xx:xxZ |\2", first_item_raw, count=1
383383
)
384-
assert first_item_normalized == reference
384+
assert reference in first_item_normalized
385385

386386

387387
def test_log_yaml_success(ldi_resources, capsys, caplog):
@@ -610,7 +610,9 @@ def test_explore_dashboards_empty_annotations(
610610
assert len(data) == 1
611611
dashboard = data[0]
612612
assert dashboard["dashboard"]["title"] == "foo"
613-
if version.parse(grafana_version) >= version.parse("10.4"):
613+
if version.parse(grafana_version) >= version.parse("12"):
614+
assert len(dashboard["dashboard"]["uid"]) == 36
615+
elif version.parse(grafana_version) >= version.parse("10.4"):
614616
assert len(dashboard["dashboard"]["uid"]) == 14
615617
elif version.parse(grafana_version) >= version.parse("9.5"):
616618
assert len(dashboard["dashboard"]["uid"]) == 36

0 commit comments

Comments
 (0)