mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: add logging for coderdtest server lifecycle (#17376)
regarding https://github.com/coder/internal/issues/581 Adds logging around the lifecyle of the coderd HTTP server.
This commit is contained in:
@ -421,6 +421,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
|
||||
handler.ServeHTTP(w, r)
|
||||
}
|
||||
}))
|
||||
t.Logf("coderdtest server listening on %s", srv.Listener.Addr().String())
|
||||
srv.Config.BaseContext = func(_ net.Listener) context.Context {
|
||||
return ctx
|
||||
}
|
||||
@ -433,7 +434,12 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
|
||||
} else {
|
||||
srv.Start()
|
||||
}
|
||||
t.Cleanup(srv.Close)
|
||||
t.Logf("coderdtest server started on %s", srv.URL)
|
||||
t.Cleanup(func() {
|
||||
t.Logf("closing coderdtest server on %s", srv.Listener.Addr().String())
|
||||
srv.Close()
|
||||
t.Logf("closed coderdtest server on %s", srv.Listener.Addr().String())
|
||||
})
|
||||
|
||||
tcpAddr, ok := srv.Listener.Addr().(*net.TCPAddr)
|
||||
require.True(t, ok)
|
||||
|
Reference in New Issue
Block a user