Skip to content

Commit faab836

Browse files
use test helpers
1 parent c9f500c commit faab836

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

api/krusty/fnplugin_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -565,23 +565,21 @@ func TestFnContainerTransformer(t *testing.T) {
565565
skipIfNoDocker(t)
566566
th := kusttest_test.MakeHarness(t)
567567
o := th.MakeOptionsPluginsEnabled()
568-
fSys := filesys.MakeFsOnDisk()
569-
b := MakeKustomizer(&o)
570568
tmpDir, err := filesys.NewTmpConfirmedDir()
571569
assert.NoError(t, err)
572-
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
570+
th.WriteK(tmpDir.String(), `
573571
resources:
574572
- deployment.yaml
575573
transformers:
576574
- e2econtainerconfig.yaml
577-
`)))
578-
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "deployment.yaml"), []byte(`
575+
`)
576+
th.WriteF(filepath.Join(tmpDir.String(), "deployment.yaml"), `
579577
apiVersion: apps/v1
580578
kind: Deployment
581579
metadata:
582580
name: foo
583-
`)))
584-
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "e2econtainerconfig.yaml"), []byte(`
581+
`)
582+
th.WriteF(filepath.Join(tmpDir.String(), "e2econtainerconfig.yaml"), `
585583
apiVersion: example.com/v1alpha1
586584
kind: Input
587585
metadata:
@@ -590,9 +588,8 @@ metadata:
590588
config.kubernetes.io/function: |
591589
container:
592590
image: "gcr.io/kustomize-functions/e2econtainerconfig"
593-
`)))
594-
m, err := b.Run(fSys, tmpDir.String())
595-
assert.NoError(t, err)
591+
`)
592+
m := th.Run(tmpDir.String(), o)
596593
actual, err := m.AsYaml()
597594
assert.NoError(t, err)
598595
assert.Equal(t, `apiVersion: apps/v1

0 commit comments

Comments
 (0)