Skip to content

Commit a0f8f79

Browse files
func25valyala
andauthored
vlogscli/vlogsgenerator/apptest: minor changes to HTTP-related code paths (#567)
Co-authored-by: Aliaksandr Valialkin <[email protected]>
1 parent d1b8482 commit a0f8f79

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

app/vlogscli/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ func getQueryResponse(ctx context.Context, output io.Writer, qStr string, output
423423
body = []byte(fmt.Sprintf("cannot read response body: %s", err))
424424
}
425425
fmt.Fprintf(output, "unexpected status code: %d; response body:\n%s\n", resp.StatusCode, body)
426+
_ = resp.Body.Close()
426427
return nil
427428
}
428429

app/vlogsgenerator/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func generateAndPushLogs(cfg *workerConfig, workerID int) {
209209
defer resp.Body.Close()
210210

211211
if resp.StatusCode/100 != 2 {
212-
logger.Fatalf("unexpected status code got from %q: %d; want 2xx", cfg.url, err)
212+
logger.Fatalf("unexpected status code got from %q: %d; want 2xx", cfg.url, resp.StatusCode)
213213
}
214214

215215
// Wait until all the generateLogs goroutine is finished.

apptest/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func readAllAndClose(t *testing.T, responseBody io.ReadCloser) string {
109109
defer responseBody.Close()
110110
b, err := io.ReadAll(responseBody)
111111
if err != nil {
112-
t.Fatalf("could not read response body: %d", err)
112+
t.Fatalf("could not read response body: %s", err)
113113
}
114114
return string(b)
115115
}

0 commit comments

Comments
 (0)