Skip to content

Commit

Permalink
chore: remove refs to deprecated io/ioutil (#2541)
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored Sep 5, 2023
1 parent 741ac7f commit a1ac235
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/cni-metrics-helper/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package metrics

import (
"context"
"io/ioutil"
"os"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -40,7 +40,7 @@ func newTestMetricsTarget(metricFile string, interestingMetrics map[string]metri
}

func (target *testMetricsTarget) grabMetricsFromTarget(ctx context.Context, targetName string) ([]byte, error) {
testMetrics, _ := ioutil.ReadFile(target.metricFile)
testMetrics, _ := os.ReadFile(target.metricFile)

return testMetrics, nil
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/ipamd/datastore/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package datastore

import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
)
Expand Down Expand Up @@ -78,7 +77,7 @@ func NewJSONFile(path string) *JSONFile {

// Checkpoint implements the Checkpointer interface
func (c *JSONFile) Checkpoint(data interface{}) error {
f, err := ioutil.TempFile(filepath.Dir(c.path), filepath.Base(c.path)+".tmp*")
f, err := os.CreateTemp(filepath.Dir(c.path), filepath.Base(c.path)+".tmp*")
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions test/framework/resources/aws/utils/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package utils

import (
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"

Expand Down Expand Up @@ -73,7 +73,7 @@ type AWSAuthMapRole struct {
// Create self managed node group stack
func CreateAndWaitTillSelfManagedNGReady(f *framework.Framework, properties NodeGroupProperties) error {
templatePath := utils.GetProjectRoot() + CreateNodeGroupCFNTemplate
templateBytes, err := ioutil.ReadFile(templatePath)
templateBytes, err := os.ReadFile(templatePath)
if err != nil {
return fmt.Errorf("failed to read from %s, %v", templatePath, err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/ipamd/ipamd_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package ipamd

import (
"fmt"
"io/ioutil"
"net/url"
"os"
"strings"
"time"

Expand Down Expand Up @@ -79,7 +79,7 @@ var _ = Describe("test aws-node pod event", func() {
masterPolicyName = "masters." + *aws.String(f.Options.ClusterName)
nodePolicyName = "nodes." + *aws.String(f.Options.ClusterName)
dummyPolicyDocumentPath := utils.GetProjectRoot() + DummyPolicyDocument
dummyRolePolicyBytes, err := ioutil.ReadFile(dummyPolicyDocumentPath)
dummyRolePolicyBytes, err := os.ReadFile(dummyPolicyDocumentPath)
Expect(err).ToNot(HaveOccurred())

dummyRolePolicyData := string(dummyRolePolicyBytes)
Expand Down

0 comments on commit a1ac235

Please sign in to comment.