@@ -94,37 +94,7 @@ var _ = It("Upgrade from RHOAI 2.13", func() {
94
94
})
95
95
96
96
// wait for controllers to stabilize reconciling all the YAMLs
97
- EventuallyConsistently (ECCheck [[]* io_prometheus_client.MetricFamily ]{
98
- State : nil ,
99
- Fetch : func (g Gomega , s * []* io_prometheus_client.MetricFamily ) {
100
- metrics , err := metrics .Registry .Gather ()
101
- Expect (err ).To (Succeed ())
102
- * s = metrics
103
- },
104
- Check : func (g Gomega , s * []* io_prometheus_client.MetricFamily ) {
105
- metricFamilies , err := metrics .Registry .Gather ()
106
- Expect (err ).To (Succeed ())
107
-
108
- // these counters need to remain at zero for ConsistentDuration
109
- metric := lookupMetricWithLabel (metricFamilies , "workqueue_depth" , "name" , "notebook" )
110
- g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
111
- metric = lookupMetricWithLabel (metricFamilies , "workqueue_unfinished_work_seconds" , "name" , "notebook" )
112
- g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
113
- metric = lookupMetricWithLabel (metricFamilies , "controller_runtime_webhook_requests_in_flight" , "webhook" , "/mutate-notebook-v1" )
114
- g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
115
-
116
- // and these counters are to stay constant
117
- g .Expect (sumUpMetricsWithLabel (metricFamilies , "workqueue_adds_total" , "webhook" , "/mutate-notebook-v1" )).To (
118
- Equal (sumUpMetricsWithLabel (* s , "workqueue_adds_total" , "webhook" , "/mutate-notebook-v1" )))
119
- g .Expect (sumUpMetricsWithLabel (metricFamilies , "controller_runtime_reconcile_total" , "" , "" )).To (
120
- Equal (sumUpMetricsWithLabel (* s , "controller_runtime_reconcile_total" , "" , "" )))
121
- g .Expect (sumUpMetricsWithLabel (metricFamilies , "rest_client_requests_total" , "" , "" )).To (
122
- Equal (sumUpMetricsWithLabel (* s , "rest_client_requests_total" , "" , "" )))
123
- },
124
- EventualTimeout : timeout ,
125
- ConsistentInterval : 250 * time .Millisecond ,
126
- ConsistentDuration : interval ,
127
- })
97
+ waitForReconcilations ()
128
98
129
99
By ("compares notebook on cluster and notebook in YAMLs has same spec" , func () {
130
100
var notebookCluster appsv1.StatefulSet
@@ -166,6 +136,40 @@ var _ = It("Upgrade from RHOAI 2.13", func() {
166
136
subctxCancel ()
167
137
})
168
138
139
+ func waitForReconcilations () {
140
+ EventuallyConsistently (ECCheck [[]* io_prometheus_client.MetricFamily ]{
141
+ State : nil ,
142
+ Fetch : func (g Gomega , s * []* io_prometheus_client.MetricFamily ) {
143
+ metrics , err := metrics .Registry .Gather ()
144
+ Expect (err ).To (Succeed ())
145
+ * s = metrics
146
+ },
147
+ Check : func (g Gomega , s * []* io_prometheus_client.MetricFamily ) {
148
+ metricFamilies , err := metrics .Registry .Gather ()
149
+ Expect (err ).To (Succeed ())
150
+
151
+ // these counters need to remain at zero for ConsistentDuration
152
+ metric := lookupMetricWithLabel (metricFamilies , "workqueue_depth" , "name" , "notebook" )
153
+ g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
154
+ metric = lookupMetricWithLabel (metricFamilies , "workqueue_unfinished_work_seconds" , "name" , "notebook" )
155
+ g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
156
+ metric = lookupMetricWithLabel (metricFamilies , "controller_runtime_webhook_requests_in_flight" , "webhook" , "/mutate-notebook-v1" )
157
+ g .Expect (metric .Gauge .GetValue ()).To (Equal (0.0 ))
158
+
159
+ // and these counters are to stay constant
160
+ g .Expect (sumUpMetricsWithLabel (metricFamilies , "workqueue_adds_total" , "webhook" , "/mutate-notebook-v1" )).To (
161
+ Equal (sumUpMetricsWithLabel (* s , "workqueue_adds_total" , "webhook" , "/mutate-notebook-v1" )))
162
+ g .Expect (sumUpMetricsWithLabel (metricFamilies , "controller_runtime_reconcile_total" , "" , "" )).To (
163
+ Equal (sumUpMetricsWithLabel (* s , "controller_runtime_reconcile_total" , "" , "" )))
164
+ g .Expect (sumUpMetricsWithLabel (metricFamilies , "rest_client_requests_total" , "" , "" )).To (
165
+ Equal (sumUpMetricsWithLabel (* s , "rest_client_requests_total" , "" , "" )))
166
+ },
167
+ EventualTimeout : timeout ,
168
+ ConsistentInterval : 250 * time .Millisecond ,
169
+ ConsistentDuration : interval ,
170
+ })
171
+ }
172
+
169
173
func lookupMetricWithLabel (metricFamilies []* io_prometheus_client.MetricFamily , metricName , labelName , LabelValue string ) (result * io_prometheus_client.Metric ) {
170
174
for _ , metric := range lookupMetricsWithLabel (metricFamilies , metricName , labelName , LabelValue ) {
171
175
if result != nil {
0 commit comments