mirror of
https://github.com/traefik/traefik.git
synced 2026-05-28 04:35:59 -04:00
Mitigate TestShutdown flakyness
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Build and Publish Documentation / Doc Process (push) Has been cancelled
Build experimental image on branch / build-webui (push) Has been cancelled
Build experimental image on branch / Build experimental image on branch (push) Has been cancelled
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Build and Publish Documentation / Doc Process (push) Has been cancelled
Build experimental image on branch / build-webui (push) Has been cancelled
Build experimental image on branch / Build experimental image on branch (push) Has been cancelled
This commit is contained in:
parent
5e2b393ceb
commit
f3ecfa82bc
1 changed files with 6 additions and 0 deletions
|
|
@ -250,13 +250,19 @@ func TestShutdown(t *testing.T) {
|
|||
// Start sending packets, to create a "session" with the server.
|
||||
requireEcho(t, "TEST", conn, time.Second)
|
||||
|
||||
shutdownStartedChan := make(chan struct{})
|
||||
doneChan := make(chan struct{})
|
||||
go func() {
|
||||
close(shutdownStartedChan)
|
||||
err := l.Shutdown(5 * time.Second)
|
||||
require.NoError(t, err)
|
||||
close(doneChan)
|
||||
}()
|
||||
|
||||
// Wait until shutdown has started, and hopefully after 100 ms the listener has stopped accepting new sessions.
|
||||
<-shutdownStartedChan
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
// Make sure that our session is still live even after the shutdown.
|
||||
requireEcho(t, "TEST2", conn, time.Second)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue