mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 00:52:55 +00:00
Stop using deprecated ioutil functions
This commit is contained in:
@@ -6,7 +6,6 @@ package commands_test
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -32,7 +31,7 @@ func TestTreeCommandDefaultCurDir_files(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
err = os.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Abstraction
|
||||
metadata:
|
||||
@@ -67,7 +66,7 @@ spec:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
err = os.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
@@ -103,7 +102,7 @@ spec:
|
||||
func TestTreeCommand_files(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
err := os.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Abstraction
|
||||
metadata:
|
||||
@@ -138,7 +137,7 @@ spec:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
err = os.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
@@ -173,7 +172,7 @@ spec:
|
||||
func TestTreeCommand_Kustomization(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
err := os.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
@@ -187,7 +186,7 @@ spec:
|
||||
return
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(d, "Kustomization"), []byte(`apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
err = os.WriteFile(filepath.Join(d, "Kustomization"), []byte(`apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- f2.yaml
|
||||
@@ -220,7 +219,7 @@ func TestTreeCommand_subpkgs(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
err = os.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Abstraction
|
||||
metadata:
|
||||
@@ -255,7 +254,7 @@ spec:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "subpkg", "f2.yaml"), []byte(`kind: Deployment
|
||||
err = os.WriteFile(filepath.Join(d, "subpkg", "f2.yaml"), []byte(`kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
@@ -269,7 +268,7 @@ spec:
|
||||
return
|
||||
}
|
||||
|
||||
err = ioutil.WriteFile(filepath.Join(d, "Krmfile"), []byte(`apiVersion: kpt.dev/v1alpha1
|
||||
err = os.WriteFile(filepath.Join(d, "Krmfile"), []byte(`apiVersion: kpt.dev/v1alpha1
|
||||
kind: Krmfile
|
||||
metadata:
|
||||
name: mainpkg
|
||||
@@ -279,7 +278,7 @@ openAPI:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "subpkg", "Krmfile"), []byte(`apiVersion: kpt.dev/v1alpha1
|
||||
err = os.WriteFile(filepath.Join(d, "subpkg", "Krmfile"), []byte(`apiVersion: kpt.dev/v1alpha1
|
||||
kind: Krmfile
|
||||
metadata:
|
||||
name: subpkg
|
||||
@@ -423,7 +422,7 @@ spec:
|
||||
func TestTreeCommand_includeReconcilers(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
err := os.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
@@ -446,7 +445,7 @@ spec:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`
|
||||
err = os.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`
|
||||
apiVersion: gcr.io/example/reconciler:v1
|
||||
kind: Abstraction
|
||||
metadata:
|
||||
@@ -491,7 +490,7 @@ spec:
|
||||
func TestTreeCommand_excludeNonReconcilers(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
|
||||
err := ioutil.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
err := os.WriteFile(filepath.Join(d, "f1.yaml"), []byte(`
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
@@ -514,7 +513,7 @@ spec:
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
err = ioutil.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`
|
||||
err = os.WriteFile(filepath.Join(d, "f2.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Abstraction
|
||||
metadata:
|
||||
|
||||
Reference in New Issue
Block a user