Skip to content

Commit

Permalink
pkg/proc,pkg/terminal: close response body in tests (#3372)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored May 17, 2023
1 parent 84b757a commit c5d9baa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pkg/proc/proc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,10 @@ func TestNextNetHTTP(t *testing.T) {
}
time.Sleep(50 * time.Millisecond)
}
http.Get("http://127.0.0.1:9191")
resp, err := http.Get("http://127.0.0.1:9191")
if err == nil {
resp.Body.Close()
}
}()
if err := grp.Continue(); err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -2913,7 +2916,10 @@ func TestAttachDetach(t *testing.T) {
assertNoError(err, t, "Attach")
go func() {
time.Sleep(1 * time.Second)
http.Get("http://127.0.0.1:9191")
resp, err := http.Get("http://127.0.0.1:9191")
if err == nil {
resp.Body.Close()
}
}()

assertNoError(p.Continue(), t, "Continue")
Expand Down
5 changes: 4 additions & 1 deletion pkg/terminal/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,10 @@ func TestIssue827(t *testing.T) {
withTestTerminal("notify-v2", t, func(term *FakeTerminal) {
go func() {
time.Sleep(1 * time.Second)
http.Get("http://127.0.0.1:8888/test")
resp, err := http.Get("http://127.0.0.1:8888/test")
if err == nil {
resp.Body.Close()
}
time.Sleep(1 * time.Second)
term.client.Halt()
}()
Expand Down

0 comments on commit c5d9baa

Please sign in to comment.