mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-02 07:35:21 +00:00
test(workqueue): deflake TestMetrics
Signed-off-by: knight42 <anonymousknight96@gmail.com> Kubernetes-commit: b70e1d836c2d438af6b01fd297677b900b364a33
This commit is contained in:
committed by
Kubernetes Publisher
parent
ebfbb6a14e
commit
f2963a02f6
@@ -252,13 +252,17 @@ func TestMetrics(t *testing.T) {
|
|||||||
// use a channel to ensure we don't look at the metric before it's
|
// use a channel to ensure we don't look at the metric before it's
|
||||||
// been set.
|
// been set.
|
||||||
ch := make(chan struct{}, 1)
|
ch := make(chan struct{}, 1)
|
||||||
|
longestCh := make(chan struct{}, 1)
|
||||||
mp.unfinished.notifyCh = ch
|
mp.unfinished.notifyCh = ch
|
||||||
|
mp.longest.notifyCh = longestCh
|
||||||
c.Step(time.Millisecond)
|
c.Step(time.Millisecond)
|
||||||
<-ch
|
<-ch
|
||||||
mp.unfinished.notifyCh = nil
|
mp.unfinished.notifyCh = nil
|
||||||
if e, a := .001, mp.unfinished.gaugeValue(); e != a {
|
if e, a := .001, mp.unfinished.gaugeValue(); e != a {
|
||||||
t.Errorf("expected %v, got %v", e, a)
|
t.Errorf("expected %v, got %v", e, a)
|
||||||
}
|
}
|
||||||
|
<-longestCh
|
||||||
|
mp.longest.notifyCh = nil
|
||||||
if e, a := .001, mp.longest.gaugeValue(); e != a {
|
if e, a := .001, mp.longest.gaugeValue(); e != a {
|
||||||
t.Errorf("expected %v, got %v", e, a)
|
t.Errorf("expected %v, got %v", e, a)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user