Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/cmd/envoy/shutdown_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

// setupFakeEnvoyStats set up an HTTP server return content
func setupFakeEnvoyStats(t *testing.T, content string) *http.Server {
// Reuse the bound listener instead of closing and re-binding the port.
l, err := net.Listen("tcp", ":0") //nolint: gosec
require.NoError(t, err)
require.NoError(t, l.Close())
mux := http.NewServeMux()
mux.HandleFunc("/", func(writer http.ResponseWriter, _ *http.Request) {
writer.Header().Set("Content-Type", "application/json")
Expand All @@ -39,7 +39,7 @@ func setupFakeEnvoyStats(t *testing.T, content string) *http.Server {
}
t.Logf("start to listen at %s ", addr)
go func() {
if err := s.ListenAndServe(); err != nil {
if err := s.Serve(l); err != nil {
fmt.Println("fail to listen: ", err)
}
}()
Expand Down
Loading