Reduce TestGracefulShutdownHTTP2 flakiness

This commit is contained in:
MoofMonkey 2022-10-04 10:58:19 +03:00
parent e0927f202c
commit c1cef806a5
1 changed files with 5 additions and 2 deletions

View File

@ -497,7 +497,7 @@ func TestGracefulShutdownHTTP2(t *testing.T) {
case <-rpcClientFactory.registered: case <-rpcClientFactory.registered:
break // ok break // ok
case <-time.Tick(time.Second): case <-time.Tick(time.Second):
t.Fatal("timeout out waiting for registration") t.Fatal("timed out waiting for registration")
} }
// signal graceful shutdown // signal graceful shutdown
@ -507,13 +507,16 @@ func TestGracefulShutdownHTTP2(t *testing.T) {
case <-rpcClientFactory.unregistered: case <-rpcClientFactory.unregistered:
break // ok break // ok
case <-time.Tick(time.Second): case <-time.Tick(time.Second):
t.Fatal("timeout out waiting for unregistered signal") t.Fatal("timed out waiting for unregistered signal")
} }
assert.True(t, controlStream.IsStopped()) assert.True(t, controlStream.IsStopped())
cancel() cancel()
wg.Wait() wg.Wait()
// give up CPU for a bit to let Observer.dispatchEvents propagate tunnel events
time.Sleep(300 * time.Millisecond)
events.assertSawEvent(t, Event{ events.assertSawEvent(t, Event{
Index: http2Conn.connIndex, Index: http2Conn.connIndex,
EventType: Unregistering, EventType: Unregistering,