1010import requests
1111from test_base import TestBase
1212
13+ GRAFANA_URL = "http://localhost:2019/grafana/"
14+
1315
1416class LoggingTest (TestBase ):
1517 def __init__ (self ):
@@ -60,7 +62,7 @@ def wait_for_endpoint_ready(self):
6062
6163 def check_endpoint ():
6264 try :
63- response = requests .get ("http://localhost:3000/ login" )
65+ response = requests .get (f" { GRAFANA_URL } login" )
6466 return response .status_code == 200
6567 except requests .RequestException :
6668 return False
@@ -75,7 +77,7 @@ def make_grafana_api_request(self, ds_uid, start, metric):
7577 "from" : f"{ start } " ,
7678 "to" : "now" ,
7779 }
78- reply = requests .post ("http://localhost:3000/ api/ds/query" , json = data )
80+ reply = requests .post (f" { GRAFANA_URL } api/ds/query" , json = data )
7981 if reply .status_code != 200 :
8082 self .log .error (f"Grafana API request failed with status code { reply .status_code } " )
8183 self .log .error (f"Response content: { reply .text } " )
@@ -92,7 +94,7 @@ def test_prometheus_and_grafana(self):
9294 self .warnet (f"run { miner_file } --allnodes --interval=5 --mature" )
9395 self .warnet (f"run { tx_flood_file } --interval=1" )
9496
95- prometheus_ds = requests .get ("http://localhost:3000/ api/datasources/name/Prometheus" )
97+ prometheus_ds = requests .get (f" { GRAFANA_URL } api/datasources/name/Prometheus" )
9698 assert prometheus_ds .status_code == 200
9799 prometheus_uid = prometheus_ds .json ()["uid" ]
98100 self .log .info (f"Got Prometheus data source uid from Grafana: { prometheus_uid } " )
0 commit comments