Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ issues:
exclude:
- G104 # Errors unhandled
- G103 # Use of unsafe calls should be audited
- G114 # Use of net/http serve function without timeouts.
# - G114 # Use of net/http serve function without timeouts.
- G115 # Integer overflow conversion should be audited
- G204 # Subprocess launched with variable
- G301 # Expect directory permissions to be 0750 or less
Expand Down
10 changes: 9 additions & 1 deletion internal/network_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"net/http"
"os/exec"
"testing"
"time"

"github.com/miekg/dns"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -132,7 +133,14 @@ func (l localNetworkServices) Serve(ctx context.Context) error {
})
}

return http.ListenAndServe(l.ipAddr+":80", nil)
srv := &http.Server{
Addr: l.ipAddr + ":80",
Handler: nil,
ReadTimeout: 5 * time.Second,
WriteTimeout: 5 * time.Second,
IdleTimeout: 30 * time.Second,
}
return srv.ListenAndServe()
})

return errGroup.Wait()
Expand Down