mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
chore: add failure test case for empty generator
This commit is contained in:
@@ -46,7 +46,7 @@ configMapGenerator:
|
||||
name: test-cm
|
||||
`,
|
||||
Args: []string{"test-cm2", "--from-literal=test-key=test-value"},
|
||||
ExpectedErrorMsg: "unable to find ConfigMap with name '\"test-cm2\"'",
|
||||
ExpectedErrorMsg: "unable to find ConfigMap with name \"test-cm2\"",
|
||||
},
|
||||
{
|
||||
Name: "fails validation because no attributes are being changed",
|
||||
@@ -76,6 +76,16 @@ configMapGenerator:
|
||||
Args: []string{"test-cm", "--from-literal=value"},
|
||||
ExpectedErrorMsg: "literal values must be specified in the key=value format",
|
||||
},
|
||||
{
|
||||
Name: "fails when the configMapGenerator field has no items",
|
||||
KustomizationFileContent: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator: []
|
||||
`,
|
||||
Args: []string{"test-cm", "--from-literal=value"},
|
||||
ExpectedErrorMsg: "unable to find ConfigMap with name \"test-cm\"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
@@ -52,7 +52,7 @@ secretGenerator:
|
||||
type: Opaque
|
||||
`,
|
||||
Args: []string{"test-secret2", "--from-literal=key3=val2"},
|
||||
ExpectedErrorMsg: "unable to find Secret with name '\"test-secret2\"'",
|
||||
ExpectedErrorMsg: "unable to find Secret with name \"test-secret2\"",
|
||||
},
|
||||
{
|
||||
Name: "fails validation because no attributes are being changed",
|
||||
@@ -83,6 +83,16 @@ secretGenerator:
|
||||
Args: []string{"test-secret", "--from-literal=value"},
|
||||
ExpectedErrorMsg: "literal values must be specified in the key=value format",
|
||||
},
|
||||
{
|
||||
Name: "fails when the secretGenerator field has no items",
|
||||
KustomizationFileContent: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator: []
|
||||
`,
|
||||
Args: []string{"test-secret", "--from-literal=value"},
|
||||
ExpectedErrorMsg: "unable to find Secret with name \"test-secret\"",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user