@@ -3,7 +3,6 @@ package internal
33
44import (
55 "fmt"
6- "io/ioutil"
76 "os"
87 "path"
98 "path/filepath"
@@ -128,7 +127,7 @@ data:
128127 enemy ,
129128 )
130129
131- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
130+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
132131 if err != nil {
133132 t .Fatalf ("Failed to write %s" , manifestPath )
134133 }
@@ -160,7 +159,7 @@ data:
160159 // template
161160 bogusFilePath := path .Join (tmpDir , "README.md" )
162161
163- err := ioutil .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
162+ err := os .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
164163 if err != nil {
165164 t .Fatalf ("Failed to write %s" , bogusFilePath )
166165 }
@@ -291,7 +290,7 @@ data:
291290 i , enemy ,
292291 )
293292
294- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
293+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
295294 if err != nil {
296295 t .Fatalf ("Failed to write %s" , manifestPath )
297296 }
@@ -314,7 +313,7 @@ resources:
314313 }
315314
316315 for kustomizePath , kustomizeYAML := range kustomizeManifests {
317- err := ioutil .WriteFile (kustomizePath , []byte (kustomizeYAML ), 0o666 )
316+ err := os .WriteFile (kustomizePath , []byte (kustomizeYAML ), 0o666 )
318317 if err != nil {
319318 t .Fatalf ("Failed to write %s" , kustomizePath )
320319 }
@@ -331,7 +330,7 @@ resources:
331330 // Write a bogus file to verify it is not picked up when creating the policy template
332331 bogusFilePath := path .Join (kustomizeDir , "this-other-file.yaml" )
333332
334- err = ioutil .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
333+ err = os .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
335334 if err != nil {
336335 t .Fatalf ("Failed to write %s" , bogusFilePath )
337336 }
@@ -448,7 +447,7 @@ data:
448447 enemy ,
449448 )
450449
451- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
450+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
452451 if err != nil {
453452 t .Fatalf ("Failed to write %s" , manifestPath )
454453 }
@@ -469,7 +468,7 @@ data:
469468 // template
470469 bogusFilePath := path .Join (tmpDir , "README.md" )
471470
472- err := ioutil .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
471+ err := os .WriteFile (bogusFilePath , []byte ("# My Manifests" ), 0o666 )
473472 if err != nil {
474473 t .Fatalf ("Failed to write %s" , bogusFilePath )
475474 }
@@ -699,7 +698,7 @@ data:
699698 game.properties: enemies=potato
700699`
701700
702- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
701+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
703702 if err != nil {
704703 t .Fatalf ("Failed to write %s" , manifestPath )
705704 }
@@ -787,7 +786,7 @@ data:
787786 image: "quay.io/potatos1"
788787`
789788
790- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
789+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
791790 if err != nil {
792791 t .Fatalf ("Failed to write %s" , manifestPath )
793792 }
@@ -896,7 +895,7 @@ data:
896895 image: "quay.io/potatos1"
897896`
898897
899- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
898+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
900899 if err != nil {
901900 t .Fatalf ("Failed to write %s" , manifestPath )
902901 }
@@ -935,7 +934,7 @@ kind: ClusterPolicy
935934metadata:
936935 name: my-awesome-policy`
937936
938- err := ioutil .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
937+ err := os .WriteFile (manifestPath , []byte (manifestYAML ), 0o666 )
939938 if err != nil {
940939 t .Fatalf ("Failed to write %s" , manifestPath )
941940 }
@@ -1052,7 +1051,7 @@ func TestGetPolicyTemplateInvalidManifest(t *testing.T) {
10521051 tmpDir := t .TempDir ()
10531052 manifestPath := path .Join (tmpDir , "configmap.yaml" )
10541053 // Ensure an error is returned when there is an invalid manifest file
1055- err := ioutil .WriteFile (manifestPath , []byte ("$i am not YAML!" ), 0o666 )
1054+ err := os .WriteFile (manifestPath , []byte ("$i am not YAML!" ), 0o666 )
10561055 if err != nil {
10571056 t .Fatalf ("Failed to write %s" , manifestPath )
10581057 }
@@ -1101,7 +1100,7 @@ data:
11011100 enemies=potato
11021101`
11031102
1104- err := ioutil .WriteFile (manifestsPath , []byte (yamlContent ), 0o666 )
1103+ err := os .WriteFile (manifestsPath , []byte (yamlContent ), 0o666 )
11051104 if err != nil {
11061105 t .Fatalf ("Failed to write %s" , manifestsPath )
11071106 }
@@ -1146,7 +1145,7 @@ data:
11461145---
11471146`
11481147
1149- err := ioutil .WriteFile (manifestsPath , []byte (yamlContent ), 0o666 )
1148+ err := os .WriteFile (manifestsPath , []byte (yamlContent ), 0o666 )
11501149 if err != nil {
11511150 t .Fatalf ("Failed to write %s" , manifestsPath )
11521151 }
@@ -1185,7 +1184,7 @@ func TestUnmarshalManifestFileInvalidYAML(t *testing.T) {
11851184 manifestPath := path .Join (tmpDir , "configmaps.yaml" )
11861185 yamlContent := `$I am not YAML`
11871186
1188- err := ioutil .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
1187+ err := os .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
11891188 if err != nil {
11901189 t .Fatalf ("Failed to write %s" , manifestPath )
11911190 }
@@ -1202,7 +1201,7 @@ func TestUnmarshalManifestFileNotObject(t *testing.T) {
12021201 manifestPath := path .Join (tmpDir , "configmaps.yaml" )
12031202 yamlContent := `- i am an array`
12041203
1205- err := ioutil .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
1204+ err := os .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
12061205 if err != nil {
12071206 t .Fatalf ("Failed to write %s" , manifestPath )
12081207 }
@@ -1262,14 +1261,14 @@ func TestVerifyManifestPath(t *testing.T) {
12621261 manifestPath := path .Join (workingDir , "configmap.yaml" )
12631262 yamlContent := "---\n kind: ConfigMap"
12641263
1265- err = ioutil .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
1264+ err = os .WriteFile (manifestPath , []byte (yamlContent ), 0o666 )
12661265 if err != nil {
12671266 t .Fatalf ("Failed to write %s" , manifestPath )
12681267 }
12691268
12701269 otherManifestPath := path .Join (otherDir , "configmap.yaml" )
12711270
1272- err = ioutil .WriteFile (otherManifestPath , []byte (yamlContent ), 0o666 )
1271+ err = os .WriteFile (otherManifestPath , []byte (yamlContent ), 0o666 )
12731272 if err != nil {
12741273 t .Fatalf ("Failed to write %s" , otherManifestPath )
12751274 }
@@ -1399,7 +1398,7 @@ data:
13991398 for filename , content := range manifestPaths {
14001399 manifestPath := path .Join (kustomizeDir , filename )
14011400
1402- err = ioutil .WriteFile (manifestPath , []byte (content ), 0o666 )
1401+ err = os .WriteFile (manifestPath , []byte (content ), 0o666 )
14031402 if err != nil {
14041403 t .Fatalf ("Failed to write %s" , manifestPath )
14051404 }
0 commit comments