@@ -42,7 +42,7 @@ func TestDgramStreamReadCompletedBecauseSocketClosed(t *testing.T) {
4242 ctx , cancel := context .WithCancel (context .Background ())
4343 // Stream is not shut down with cancel in this test
4444 defer cancel ()
45- waker , awaken := waker .NewTest ( ctx , 1 , "stream" )
45+ waker := waker .NewTestAlways ( )
4646
4747 sockName := scheme + "://" + addr
4848 ds , err := logstream .New (ctx , & wg , waker , sockName , logstream .OneShotEnabled )
@@ -59,8 +59,6 @@ func TestDgramStreamReadCompletedBecauseSocketClosed(t *testing.T) {
5959 _ , err = s .Write ([]byte ("1\n " ))
6060 testutil .FatalIfErr (t , err )
6161
62- awaken (0 , 0 ) // sync past read
63-
6462 // "Close" the socket by sending zero bytes, which in oneshot mode tells the stream to act as if we're done.
6563 _ , err = s .Write ([]byte {})
6664 testutil .FatalIfErr (t , err )
@@ -94,7 +92,7 @@ func TestDgramStreamReadCompletedBecauseCancel(t *testing.T) {
9492 }
9593
9694 ctx , cancel := context .WithCancel (context .Background ())
97- waker , awaken := waker .NewTest ( ctx , 1 , "stream" )
95+ waker := waker .NewTestAlways ( )
9896
9997 sockName := scheme + "://" + addr
10098 ds , err := logstream .New (ctx , & wg , waker , sockName , logstream .OneShotDisabled )
@@ -111,7 +109,8 @@ func TestDgramStreamReadCompletedBecauseCancel(t *testing.T) {
111109 _ , err = s .Write ([]byte ("1\n " ))
112110 testutil .FatalIfErr (t , err )
113111
114- awaken (0 , 0 ) // Synchronise past read.
112+ // Yield to give the stream a chance to read.
113+ time .Sleep (10 * time .Millisecond )
115114
116115 cancel () // This cancellation should cause the stream to shut down.
117116 wg .Wait ()
0 commit comments