mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 09:02:53 +00:00
Better support for testing tranformers with kyaml support
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
package main_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
@@ -19,7 +18,6 @@ metadata:
|
||||
annotations:
|
||||
app: myApp
|
||||
greeting/morning: a string with blanks
|
||||
yamlSupport: %v
|
||||
fieldSpecs:
|
||||
- path: metadata/annotations
|
||||
create: true
|
||||
@@ -48,16 +46,9 @@ spec:
|
||||
)
|
||||
|
||||
func TestAnnotationsTransformer(t *testing.T) {
|
||||
for _, b := range []bool{true, false} {
|
||||
t.Run(fmt.Sprintf("yaml-%v", b), func(t *testing.T) {
|
||||
th := kusttest_test.MakeEnhancedHarness(t).
|
||||
PrepBuiltin("AnnotationsTransformer")
|
||||
defer th.Reset()
|
||||
th := kusttest_test.MakeEnhancedHarness(t).
|
||||
PrepBuiltin("AnnotationsTransformer")
|
||||
defer th.Reset()
|
||||
|
||||
cfg := fmt.Sprintf(config, b)
|
||||
rm := th.LoadAndRunTransformer(cfg, input)
|
||||
|
||||
th.AssertActualEqualsExpected(rm, expectedOutput)
|
||||
})
|
||||
}
|
||||
th.RunTransformerAndCheckResult(config, input, expectedOutput)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user