Stabilize runtime metrics shutdown test (#22169)
Costa Tsaousis committed
Apr 9, 2026 at 10:17 UTC
5d55cb5bc8cb3b95124e68c390addd58384b8eb1
1 file changed
+13
src/go/plugin/framework/functions/runtime_metrics_test.go
+13
@@ -121,6 +121,19 @@ func TestManager_RuntimeMetricsScenarios(t *testing.T) {
121
close(release)
122
close(in.ch)
123
waitForDone(t, done)
124
+ waitForCondition(t, time.Second, func() bool {
125
+ reader := mgr.runtimeStore.Read(metrix.ReadRaw())
126
+ active, ok := reader.Value(functionsRuntimeMetricPrefix+".invocations_active", nil)
127
+ if !ok || active != 0 {
128
+ return false
129
+ }
130
+ awaiting, ok := reader.Value(functionsRuntimeMetricPrefix+".invocations_awaiting_result", nil)
131
+ if !ok || awaiting != 0 {
132
+ return false
133
+ }
134
+ pending, ok := reader.Value(functionsRuntimeMetricPrefix+".scheduler_pending", nil)
135
+ return ok && pending == 0
136
+ }, "runtime gauges settle after shutdown")
137
138
assert.GreaterOrEqual(t, runtimeMetricValue(t, mgr.runtimeStore, functionsRuntimeMetricPrefix+".queue_full_total", nil), float64(1))
139
assert.GreaterOrEqual(t, runtimeMetricValue(t, mgr.runtimeStore, functionsRuntimeMetricPrefix+".cancel_fallback_total", nil), float64(1))