Merge "Take screenshots of all grafana dashboards"

This commit is contained in:
Zuul 2025-01-27 17:35:16 +00:00 committed by Gerrit Code Review
commit 95b3a0aa97

View File

@ -14,6 +14,8 @@
from util import take_screenshots
import json
testinfra_hosts = ['grafana01.opendev.org']
@ -37,8 +39,16 @@ def test_grafana_api_denial(host):
assert '403 Forbidden' in cmd.stdout
def test_grafana_screenshots(host):
shots = (
shots = [
('https://localhost/', None, 'grafana-main-page.png'),
('https://localhost/dashboards', None, 'grafana-dashboards-page.png')
)
]
cmd = host.run("curl -s --insecure "
"--resolve grafana.opendev.org:443:127.0.0.1 "
"https://grafana.opendev.org/api/search")
j = json.loads(cmd.stdout)
for dashboard in j:
url = dashboard["url"]
name = dashboard["uri"].split("/")[-1]
shots.append(("https://localhost" + url, None, name + '.png'))
take_screenshots(host, shots)