diff --git a/internal/templates/00-assert.yaml.tmpl b/internal/templates/00-assert.yaml.tmpl index a8d55b1..f21d0fb 100644 --- a/internal/templates/00-assert.yaml.tmpl +++ b/internal/templates/00-assert.yaml.tmpl @@ -4,6 +4,9 @@ timeout: {{ .TestCase.Timeout }} commands: - command: ${KUBECTL} annotate managed --all upjet.upbound.io/test=true --overwrite {{- range $resource := .Resources }} +{{- if eq $resource.KindGroup "secret." -}} + {{continue}} +{{- end -}} {{- if $resource.PreAssertScriptPath }} - command: {{ $resource.PreAssertScriptPath }} {{- end }} diff --git a/internal/templates/01-assert.yaml.tmpl b/internal/templates/01-assert.yaml.tmpl index aa81cdb..0c95074 100644 --- a/internal/templates/01-assert.yaml.tmpl +++ b/internal/templates/01-assert.yaml.tmpl @@ -3,6 +3,9 @@ kind: TestAssert timeout: {{ .TestCase.Timeout }} commands: {{- range $resource := .Resources }} +{{- if eq $resource.KindGroup "secret." -}} + {{continue}} +{{- end -}} {{- if $resource.Namespace }} - command: ${KUBECTL} wait {{ $resource.KindGroup }}/{{ $resource.Name }} --for=delete --timeout 10s --namespace {{ $resource.Namespace }} {{- else }} diff --git a/internal/templates/01-delete.yaml.tmpl b/internal/templates/01-delete.yaml.tmpl index cf67e1c..6a572f1 100644 --- a/internal/templates/01-delete.yaml.tmpl +++ b/internal/templates/01-delete.yaml.tmpl @@ -2,6 +2,9 @@ apiVersion: kuttl.dev/v1beta1 kind: TestStep commands: {{- range $resource := .Resources }} +{{- if eq $resource.KindGroup "secret." -}} + {{continue}} +{{- end -}} {{- if $resource.PreDeleteScriptPath }} - command: {{ $resource.PreDeleteScriptPath }} {{- end }} diff --git a/internal/templates/renderer_test.go b/internal/templates/renderer_test.go index 314b370..4233f50 100644 --- a/internal/templates/renderer_test.go +++ b/internal/templates/renderer_test.go @@ -29,6 +29,16 @@ spec: count: 1 size: small ` + + secretManifest = `apiVersion: v1 +kind: Secret +metadata: + name: test-secret + namespace: upbound-system +type: Opaque +data: + key: dmFsdWU= +` ) func TestRender(t *testing.T) { @@ -108,6 +118,12 @@ commands: PreDeleteScriptPath: "/tmp/claim/pre-delete.sh", Conditions: []string{"Ready", "Synced"}, }, + { + YAML: secretManifest, + Name: "test-secret", + KindGroup: "secret.", + Namespace: "upbound-system", + }, }, }, want: want{ @@ -116,7 +132,7 @@ commands: kind: TestStep commands: - command: /tmp/setup.sh -` + "---\n" + bucketManifest + "---\n" + claimManifest, +` + "---\n" + bucketManifest + "---\n" + claimManifest + "---\n" + secretManifest, "00-assert.yaml": `apiVersion: kuttl.dev/v1beta1 kind: TestAssert timeout: 10 diff --git a/internal/tester.go b/internal/tester.go index ff4e573..318dbd3 100644 --- a/internal/tester.go +++ b/internal/tester.go @@ -56,10 +56,6 @@ func (t *Tester) prepareConfig() (*config.TestCase, []config.Resource, error) { for _, m := range t.manifests { obj := m.Object - if obj.GroupVersionKind().String() == "/v1, Kind=Secret" { - continue - } - kg := strings.ToLower(obj.GroupVersionKind().Kind + "." + obj.GroupVersionKind().Group) example := config.Resource{