mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 08:17:26 +00:00
Merge pull request #19454 from mesosphere/jdef_fix_runtime_until_flake
Auto commit by PR queue bot
This commit is contained in:
commit
eb554aa346
@ -39,25 +39,37 @@ func TestUntil(t *testing.T) {
|
|||||||
|
|
||||||
<-called
|
<-called
|
||||||
close(ch)
|
close(ch)
|
||||||
<-called
|
|
||||||
|
// wait for 'called' to be closed
|
||||||
|
for {
|
||||||
|
if _, ok := <-called; !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--
|
//--
|
||||||
ch = make(chan struct{})
|
ch = make(chan struct{})
|
||||||
called = make(chan struct{})
|
called2 := make(chan struct{})
|
||||||
running := make(chan struct{})
|
running := make(chan struct{})
|
||||||
After(func() {
|
After(func() {
|
||||||
Until(func() {
|
Until(func() {
|
||||||
close(running)
|
close(running)
|
||||||
called <- struct{}{}
|
called2 <- struct{}{}
|
||||||
}, 2*time.Second, ch)
|
}, 2*time.Second, ch)
|
||||||
}).Then(func() { close(called) })
|
}).Then(func() { close(called2) })
|
||||||
|
|
||||||
<-running
|
<-running
|
||||||
close(ch)
|
close(ch)
|
||||||
<-called // unblock the goroutine
|
<-called2 // unblock the goroutine
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
<-called
|
// wait for 'called2' to be closed
|
||||||
|
for {
|
||||||
|
if _, ok := <-called2; !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if time.Since(now) > 1800*time.Millisecond {
|
if time.Since(now) > 1800*time.Millisecond {
|
||||||
t.Fatalf("Until should not have waited the full timeout period since we closed the stop chan")
|
t.Fatalf("Until should not have waited the full timeout period since we closed the stop chan")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user