File tree 3 files changed +12
-4
lines changed
3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 6
6
Self = TypeVar ("Self" , bound = "Route" )
7
7
8
8
# The constant includes all necessary error messages that can occurs, if you establish a connection to the Grafana API.
9
- ERROR_MESSAGES : list = ["invalid API key" ]
9
+ ERROR_MESSAGES : list = ["invalid API key" , "Expired API key" ]
10
10
11
11
12
12
class APIEndpoints (Enum ):
Original file line number Diff line number Diff line change 8
8
9
9
setuptools .setup (
10
10
name = "grafana-api-sdk" ,
11
- version = "0.0.9 " ,
11
+ version = "0.1.0 " ,
12
12
author = "Pascal Zimmermann" ,
13
13
14
14
description = "A Grafana API SDK" ,
Original file line number Diff line number Diff line change 1
1
import os
2
+ import time
2
3
from unittest import TestCase
3
4
4
5
from grafana_api .model import (
@@ -120,8 +121,15 @@ def test_test_alertmanager_receivers(self):
120
121
)
121
122
122
123
def test_get_prometheus_alerts (self ):
123
- self .assertEqual ("Test" ,
124
- self .alerting .get_prometheus_alerts ().get ("data" ).get ("alerts" )[0 ].get ("labels" ).get ("alertname" ))
124
+ MAX_TRIES : int = 3
125
+
126
+ for i in range (0 , MAX_TRIES ):
127
+ if len (self .alerting .get_prometheus_alerts ().get ("data" ).get ("alerts" )) != 0 :
128
+ time .sleep (0.1 + i / 2 )
129
+ self .assertEqual ("Test" ,
130
+ self .alerting .get_prometheus_alerts ().get ("data" ).get ("alerts" )[0 ].get ("labels" ).get ("alertname" ))
131
+ elif i == MAX_TRIES :
132
+ self .fail ("Conditions not yet fulfilled." )
125
133
126
134
def test_get_prometheus_rules (self ):
127
135
self .assertEqual (
You can’t perform that action at this time.
0 commit comments