Skip to content

Commit

Permalink
make deepsource happy
Browse files Browse the repository at this point in the history
  • Loading branch information
lvrach committed Aug 31, 2022
1 parent 3b3c017 commit 28b1ab1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion utils/httputil/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
func Test_ListenAndServe(t *testing.T) {
t.Run("no error when context gets canceled", func(t *testing.T) {
srv := &http.Server{
ReadHeaderTimeout: time.Second,
Addr: fmt.Sprintf(":%d", freeport.GetPort()),
}

Expand All @@ -36,6 +37,7 @@ func Test_ListenAndServe(t *testing.T) {

t.Log("running server on the same port")
srv2 := &http.Server{
ReadHeaderTimeout: time.Second,
Addr: strings.TrimPrefix(srv1.URL, "http://"),
}

Expand All @@ -54,6 +56,7 @@ func Test_ListenAndServe(t *testing.T) {
addr := fmt.Sprintf("127.0.0.1:%d", freeport.GetPort())

srv := &http.Server{
ReadHeaderTimeout: time.Second,
Addr: addr,
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
t.Log(r.URL)
Expand Down Expand Up @@ -123,6 +126,8 @@ func Test_ListenAndServe(t *testing.T) {
firstCall := make(chan struct{})

srv := &http.Server{
ReadHeaderTimeout: time.Second

Addr: addr,
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
t.Log(r.URL)
Expand Down Expand Up @@ -180,7 +185,9 @@ func Test_ListenAndServe(t *testing.T) {

func Test_Serve(t *testing.T) {
t.Run("no error when context gets canceled", func(t *testing.T) {
srv := &http.Server{}
srv := &http.Server{
ReadHeaderTimeout: time.Second
}

ctx, cancel := context.WithCancel(context.Background())
cancel()
Expand Down

0 comments on commit 28b1ab1

Please sign in to comment.