Fix adding to chanotify on blocking select
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
d99ee27874
commit
e2f3518af8
2 changed files with 25 additions and 6 deletions
|
@ -78,3 +78,18 @@ func TestConcurrentNotifier(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddToBlocked(t *testing.T) {
|
||||
s := New()
|
||||
ch := make(chan struct{}, 1)
|
||||
go func() {
|
||||
// give some time to start first select
|
||||
time.Sleep(1 * time.Second)
|
||||
s.Add(ch, "1")
|
||||
ch <- struct{}{}
|
||||
}()
|
||||
val := <-s.Chan()
|
||||
if val != "1" {
|
||||
t.Fatalf("Expected 1, got %s", val)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue