Skip to content

Commit

Permalink
chore: replace io/ioutil which was deprecated with os (#1043)
Browse files Browse the repository at this point in the history
Also remove direct dependency on yaml.v2

Signed-off-by: Harikrishnan Balagopal <harikrishmenon@gmail.com>
  • Loading branch information
HarikrishnanBalagopal authored Jun 9, 2023
1 parent d60ade6 commit d28877e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions types/ir/ir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ package ir

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

"github.com/google/go-cmp/cmp"
"github.com/konveyor/move2kube/common"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"
core "k8s.io/kubernetes/pkg/apis/core"
networking "k8s.io/kubernetes/pkg/apis/networking"
)
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestIR(t *testing.T) {

t.Run("test for merging IRs", func(t *testing.T) {

iryaml, err := ioutil.ReadFile("./testdata/ir.yaml")
iryaml, err := os.ReadFile("./testdata/ir.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -260,7 +260,7 @@ func TestIR(t *testing.T) {
return
}

newiryaml, err := ioutil.ReadFile("./testdata/newir.yaml")
newiryaml, err := os.ReadFile("./testdata/newir.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -274,7 +274,7 @@ func TestIR(t *testing.T) {
return
}

mergediryaml, err := ioutil.ReadFile("./testdata/mergedir.yaml")
mergediryaml, err := os.ReadFile("./testdata/mergedir.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand Down Expand Up @@ -307,7 +307,7 @@ func TestIR(t *testing.T) {
})

t.Run("test for merging containers images", func(t *testing.T) {
conimageyaml, err := ioutil.ReadFile("./testdata/conimage.yaml")
conimageyaml, err := os.ReadFile("./testdata/conimage.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -321,7 +321,7 @@ func TestIR(t *testing.T) {
return
}

newconimageyaml, err := ioutil.ReadFile("./testdata/newconimage.yaml")
newconimageyaml, err := os.ReadFile("./testdata/newconimage.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -337,7 +337,7 @@ func TestIR(t *testing.T) {

conimage.Merge(newconimage)

mergedconimageyaml, err := ioutil.ReadFile("./testdata/mergedconimage.yaml")
mergedconimageyaml, err := os.ReadFile("./testdata/mergedconimage.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -358,7 +358,7 @@ func TestIR(t *testing.T) {
})

t.Run("test for merging containerbuilds", func(t *testing.T) {
conbuildyaml, err := ioutil.ReadFile("./testdata/conbuild.yaml")
conbuildyaml, err := os.ReadFile("./testdata/conbuild.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -372,7 +372,7 @@ func TestIR(t *testing.T) {
return
}

newconbuildyaml, err := ioutil.ReadFile("./testdata/newconbuild.yaml")
newconbuildyaml, err := os.ReadFile("./testdata/newconbuild.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -388,7 +388,7 @@ func TestIR(t *testing.T) {

conbuild.Merge(newconbuild)

mergedconbuildyaml, err := ioutil.ReadFile("./testdata/mergedconbuild.yaml")
mergedconbuildyaml, err := os.ReadFile("./testdata/mergedconbuild.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -409,7 +409,7 @@ func TestIR(t *testing.T) {
})

t.Run("test for merging services", func(t *testing.T) {
serviceyaml, err := ioutil.ReadFile("./testdata/service.yaml")
serviceyaml, err := os.ReadFile("./testdata/service.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -422,7 +422,7 @@ func TestIR(t *testing.T) {
return
}

newserviceyaml, err := ioutil.ReadFile("./testdata/nservice.yaml")
newserviceyaml, err := os.ReadFile("./testdata/nservice.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand All @@ -436,7 +436,7 @@ func TestIR(t *testing.T) {
}
service.merge(newservice)

mergedserviceyaml, err := ioutil.ReadFile("./testdata/merged_service.yaml")
mergedserviceyaml, err := os.ReadFile("./testdata/merged_service.yaml")
if err != nil {
fmt.Println("Failed to read YAML file:", err)
return
Expand Down

0 comments on commit d28877e

Please sign in to comment.