@@ -17,6 +17,8 @@ import (
1717 "github.com/slok/sloth/test/integration/testutils"
1818)
1919
20+ const controllerEventualConsistencySleep = 2000 * time .Millisecond
21+
2022// sanitizePrometheusRule will remove all the dynamic fields on a monitoringv1.PrometheusRule object
2123// these fileds are normally set by Kubernetes.
2224func sanitizePrometheusRule (pr * monitoringv1.PrometheusRule ) * monitoringv1.PrometheusRule {
@@ -60,7 +62,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
6062 require .NoError (t , err )
6163
6264 // Wait to be sure the controller had time for handling.
63- time .Sleep (500 * time . Millisecond )
65+ time .Sleep (controllerEventualConsistencySleep )
6466
6567 // Check.
6668 expRule := getBasePromOpPrometheusRule (version )
@@ -83,7 +85,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
8385 require .NoError (t , err )
8486
8587 // Wait to be sure the controller had time for handling.
86- time .Sleep (500 * time . Millisecond )
88+ time .Sleep (controllerEventualConsistencySleep )
8789
8890 // Check.
8991 expRule := getBase28DayPromOpPrometheusRule (version )
@@ -106,7 +108,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
106108 require .NoError (t , err )
107109
108110 // Wait to be sure the controller had time for handling.
109- time .Sleep (500 * time . Millisecond )
111+ time .Sleep (controllerEventualConsistencySleep )
110112
111113 // Check.
112114 expRule := getSLIPluginsPromOpPrometheusRule (version )
@@ -129,7 +131,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
129131 require .NoError (t , err )
130132
131133 // Wait to be sure the controller had time for handling.
132- time .Sleep (500 * time . Millisecond )
134+ time .Sleep (controllerEventualConsistencySleep )
133135
134136 // Check.
135137 expRule := getSLOPluginsPromOpPrometheusRule (version )
@@ -152,7 +154,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
152154 require .NoError (t , err )
153155
154156 // Wait to be sure the controller had time for handling.
155- time .Sleep (500 * time . Millisecond )
157+ time .Sleep (controllerEventualConsistencySleep )
156158
157159 // Check.
158160 gotSLOs , err := kubeClis .Sloth .SlothV1 ().PrometheusServiceLevels (ns ).Get (ctx , SLOs .Name , metav1.GetOptions {})
@@ -180,7 +182,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
180182 require .NoError (t , err )
181183
182184 // Wait to be sure the controller had time for handling.
183- time .Sleep (500 * time . Millisecond )
185+ time .Sleep (controllerEventualConsistencySleep )
184186
185187 // Check.
186188 gotSLOs , err := kubeClis .Sloth .SlothV1 ().PrometheusServiceLevels (ns ).Get (ctx , SLOs .Name , metav1.GetOptions {})
@@ -208,7 +210,7 @@ func TestKubernetesControllerPromOperatorGenerate(t *testing.T) {
208210 require .NoError (t , err )
209211
210212 // Wait to be sure the controller had time for handling.
211- time .Sleep (500 * time . Millisecond )
213+ time .Sleep (controllerEventualConsistencySleep )
212214
213215 // Check.
214216 expRule := getBase7DayPromOpPrometheusRule (version )
0 commit comments