Skip to content

Commit

Permalink
Switch to io.ReadAll (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
itaispiegel authored Aug 5, 2024
1 parent 60faf8a commit b76e607
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package collector

import (
"fmt"
"io/ioutil"
"io"
"net"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestDnsmasqExporter(t *testing.T) {

t.Run("should not expose lease information when disabled", func(t *testing.T) {
metrics := fetchMetrics(t, c)
for key, _ := range metrics {
for key := range metrics {
if strings.Contains(key, "dnsmasq_lease_expiry") {
t.Errorf("lease information should not be exposed when disabled: %v", key)
}
Expand Down Expand Up @@ -199,10 +199,10 @@ func fetchMetrics(t *testing.T, c *Collector) map[string]string {
handler.ServeHTTP(rec, httptest.NewRequest("GET", "/metrics", nil))
resp := rec.Result()
if got, want := resp.StatusCode, http.StatusOK; got != want {
b, _ := ioutil.ReadAll(resp.Body)
b, _ := io.ReadAll(resp.Body)
t.Fatalf("unexpected HTTP status: got %v (%v), want %v", resp.Status, string(b), want)
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit b76e607

Please sign in to comment.