Skip to content

Commit b70e1d8

Browse files
committed
test(workqueue): deflake TestMetrics
Signed-off-by: knight42 <[email protected]>
1 parent 1f708f6 commit b70e1d8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

staging/src/k8s.io/client-go/util/workqueue/metrics_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,17 @@ func TestMetrics(t *testing.T) {
252252
// use a channel to ensure we don't look at the metric before it's
253253
// been set.
254254
ch := make(chan struct{}, 1)
255+
longestCh := make(chan struct{}, 1)
255256
mp.unfinished.notifyCh = ch
257+
mp.longest.notifyCh = longestCh
256258
c.Step(time.Millisecond)
257259
<-ch
258260
mp.unfinished.notifyCh = nil
259261
if e, a := .001, mp.unfinished.gaugeValue(); e != a {
260262
t.Errorf("expected %v, got %v", e, a)
261263
}
264+
<-longestCh
265+
mp.longest.notifyCh = nil
262266
if e, a := .001, mp.longest.gaugeValue(); e != a {
263267
t.Errorf("expected %v, got %v", e, a)
264268
}

0 commit comments

Comments
 (0)