mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Harden anno transformer test.
This commit is contained in:
@@ -9,8 +9,12 @@ import (
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
var (
|
||||
config = `
|
||||
func TestAnnotationsTransformer(t *testing.T) {
|
||||
th := kusttest_test.MakeEnhancedHarness(t).
|
||||
PrepBuiltin("AnnotationsTransformer")
|
||||
defer th.Reset()
|
||||
|
||||
th.RunTransformerAndCheckResult(`
|
||||
apiVersion: builtin
|
||||
kind: AnnotationsTransformer
|
||||
metadata:
|
||||
@@ -18,11 +22,14 @@ metadata:
|
||||
annotations:
|
||||
app: myApp
|
||||
greeting/morning: a string with blanks
|
||||
booleanNaked: true
|
||||
booleanQuoted: "true"
|
||||
numberNaked: 42
|
||||
numberQuoted: "42"
|
||||
fieldSpecs:
|
||||
- path: metadata/annotations
|
||||
create: true
|
||||
`
|
||||
input = `
|
||||
`, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
@@ -30,25 +37,20 @@ metadata:
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
`
|
||||
expectedOutput = `
|
||||
`, `
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
app: myApp
|
||||
booleanNaked: "true"
|
||||
booleanQuoted: "true"
|
||||
greeting/morning: a string with blanks
|
||||
numberNaked: "42"
|
||||
numberQuoted: "42"
|
||||
name: myService
|
||||
spec:
|
||||
ports:
|
||||
- port: 7002
|
||||
`
|
||||
)
|
||||
|
||||
func TestAnnotationsTransformer(t *testing.T) {
|
||||
th := kusttest_test.MakeEnhancedHarness(t).
|
||||
PrepBuiltin("AnnotationsTransformer")
|
||||
defer th.Reset()
|
||||
|
||||
th.RunTransformerAndCheckResult(config, input, expectedOutput)
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user