Skip to content

Commit

Permalink
chore: Stop using deprecated ioutil package
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <[email protected]>
  • Loading branch information
kichristensen committed Sep 23, 2024
1 parent fd9057b commit 74c0c8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/skeletor/action_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package skeletor

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

"get.porter.sh/porter/pkg/exec/builder"
Expand All @@ -12,7 +12,7 @@ import (
)

func TestMixin_UnmarshalStep(t *testing.T) {
b, err := ioutil.ReadFile("testdata/step-input.yaml")
b, err := os.ReadFile("testdata/step-input.yaml")
require.NoError(t, err)

var action Action
Expand Down
3 changes: 1 addition & 2 deletions pkg/skeletor/execute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package skeletor
import (
"bytes"
"context"
"io/ioutil"
"os"
"path"
"testing"
Expand Down Expand Up @@ -36,7 +35,7 @@ func TestMixin_Execute(t *testing.T) {
m := NewTestMixin(t)

m.Setenv(test.ExpectedCommandEnv, tc.wantCommand)
mixinInputB, err := ioutil.ReadFile(tc.file)
mixinInputB, err := os.ReadFile(tc.file)
require.NoError(t, err)

m.In = bytes.NewBuffer(mixinInputB)
Expand Down
6 changes: 3 additions & 3 deletions pkg/skeletor/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package skeletor

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

"github.com/ghodss/yaml" // We are not using go-yaml because of serialization problems with jsonschema, don't use this library elsewhere
Expand All @@ -17,7 +17,7 @@ func TestMixin_PrintSchema(t *testing.T) {
m.PrintSchema()
gotSchema := m.TestContext.GetOutput()

wantSchema, err := ioutil.ReadFile("schema/schema.json")
wantSchema, err := os.ReadFile("schema/schema.json")
require.NoError(t, err)

assert.Equal(t, string(wantSchema), gotSchema)
Expand All @@ -41,7 +41,7 @@ func TestMixin_ValidateSchema(t *testing.T) {
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
// Read the mixin input as a go dump
mixinInputB, err := ioutil.ReadFile(tc.file)
mixinInputB, err := os.ReadFile(tc.file)
require.NoError(t, err)
mixinInputMap := make(map[string]interface{})
err = yaml.Unmarshal(mixinInputB, &mixinInputMap)
Expand Down

0 comments on commit 74c0c8b

Please sign in to comment.