Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com>
  • Loading branch information
simonswine and MichelHollands committed Apr 21, 2022
1 parent acb3e90 commit 3919361
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions integration/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -150,7 +149,7 @@ func (c *Client) pushLogLine(line string, timestamp time.Time, extraLabelList ..
return nil
}

buf, err := ioutil.ReadAll(res.Body)
buf, err := io.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("reading request failed with status code %v: %w", res.StatusCode, err)
}
Expand Down Expand Up @@ -430,7 +429,7 @@ func (c *Client) run(u string) ([]byte, int, error) {
}
defer res.Body.Close()

buf, err := ioutil.ReadAll(res.Body)
buf, err := io.ReadAll(res.Body)
if err != nil {
return nil, 0, fmt.Errorf("request failed with status code %v: %w", res.StatusCode, err)
}
Expand Down
12 changes: 5 additions & 7 deletions integration/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"net"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -115,7 +114,7 @@ type Cluster struct {

func New() *Cluster {
wrapRegistry()
sharedPath, err := ioutil.TempDir("", "loki-shared-data")
sharedPath, err := os.MkdirTemp("", "loki-shared-data")
if err != nil {
panic(err.Error())
}
Expand Down Expand Up @@ -157,7 +156,6 @@ func (c *Cluster) Cleanup() error {
c.waitGroup.Wait()

// cleanup dirs/files

for _, d := range dirs {
errs.Add(os.RemoveAll(d))
}
Expand Down Expand Up @@ -220,14 +218,14 @@ func (c *Component) GRPCURL() *url.URL {
func (c *Component) writeConfig() error {
var err error

configFile, err := ioutil.TempFile("", "loki-config")
configFile, err := os.CreateTemp("", "loki-config")
if err != nil {
return fmt.Errorf("error creating config file: %w", err)
}

c.dataPath, err = ioutil.TempDir("", "loki-data")
c.dataPath, err = os.MkdirTemp("", "loki-data")
if err != nil {
return fmt.Errorf("error creating config file: %w", err)
return fmt.Errorf("error creating data path: %w", err)
}

if err := configTemplate.Execute(configFile, map[string]interface{}{
Expand All @@ -241,7 +239,7 @@ func (c *Component) writeConfig() error {
}

if err := configFile.Close(); err != nil {
return fmt.Errorf("error writing config file: %w", err)
return fmt.Errorf("error closing config file: %w", err)
}
c.configFile = configFile.Name()

Expand Down
2 changes: 1 addition & 1 deletion integration/loki_micro_services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestMicroServicesIngestQuery(t *testing.T) {
tIngester = clu.AddComponent(
"ingester",
"-target=ingester",
// "-boltdb.shipper.index-gateway-client.server-address="+tIndexGateway.GRPCURL().Host,
"-boltdb.shipper.index-gateway-client.server-address="+tIndexGateway.GRPCURL().Host,
)
tQueryScheduler = clu.AddComponent(
"query-scheduler",
Expand Down

0 comments on commit 3919361

Please sign in to comment.