-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from sergenyalcin/improvements
Add yaml outputs of resources to streaming logs and add import&update steps to uptest
- Loading branch information
Showing
14 changed files
with
267 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
# This assert file belongs to the resource update step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: {{ .TestCase.Timeout }} | ||
commands: | ||
- script: echo "Dump MR manifests for the update assertion step:"; ${KUBECTL} get managed -o yaml | ||
{{- range $resource := .Resources }} | ||
{{- if eq $resource.UpdateParameter "" -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- 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 }} | ||
- command: ${KUBECTL} wait {{ $resource.KindGroup }}/{{ $resource.Name }} --for=delete --timeout 10s | ||
{{- if not $resource.Namespace }} | ||
{{- if $resource.Root }} | ||
- script: ${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.status.atProvider{{ $resource.UpdateAssertKey }}}' | grep -q "^{{ $resource.UpdateAssertValue }}$" | ||
{{- end }} | ||
{{- end }} | ||
- command: ${KUBECTL} wait managed --all --for=delete --timeout 10s | ||
{{- if .TestCase.TeardownScriptPath }} | ||
- command: {{ .TestCase.TeardownScriptPath }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file belongs to the resource update step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
{{- range $resource := .Resources }} | ||
{{- if eq $resource.UpdateParameter "" -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- if eq $resource.KindGroup "secret." -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- if not $resource.Namespace }} | ||
{{- if $resource.Root }} | ||
- command: ${KUBECTL} patch {{ $resource.KindGroup }}/{{ $resource.Name }} --type=merge -p '{"spec":{"forProvider":{{ $resource.UpdateParameter }}}}' | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This assert file belongs to the resource import step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: {{ .TestCase.Timeout }} | ||
commands: | ||
- script: echo "Dump MR manifests for the import assertion step:"; ${KUBECTL} get managed -o yaml | ||
{{- range $resource := .Resources }} | ||
{{- if eq $resource.KindGroup "secret." -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- range $condition := $resource.Conditions }} | ||
{{- if not $resource.Namespace }} | ||
- command: ${KUBECTL} wait {{ $resource.KindGroup }}/{{ $resource.Name }} --for=condition={{ $condition }} --timeout 10s | ||
{{- end }} | ||
{{- end }} | ||
{{- if not $resource.Namespace }} | ||
- script: new_id=$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.status.atProvider.id}') && old_id=$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.metadata.annotations.uptest-old-id}') && [ "$new_id" == "$old_id" ] | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file belongs to the resource import step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- command: ${KUBECTL} scale deployment crossplane -n upbound-system --replicas=0 | ||
- script: ${KUBECTL} -n upbound-system get deploy --no-headers -o custom-columns=":metadata.name" | grep "provider-" | xargs ${KUBECTL} -n upbound-system scale deploy --replicas=0 | ||
{{- range $resource := .Resources }} | ||
{{- if eq $resource.KindGroup "secret." -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- if not $resource.Namespace }} | ||
- command: ${KUBECTL} --subresource=status patch {{ $resource.KindGroup }}/{{ $resource.Name }} --type=merge -p '{"status":{"conditions":[]}}' | ||
- script: ${KUBECTL} annotate {{ $resource.KindGroup }}/{{ $resource.Name }} uptest-old-id=$(${KUBECTL} get {{ $resource.KindGroup }}/{{ $resource.Name }} -o=jsonpath='{.status.atProvider.id}') --overwrite | ||
{{- end }} | ||
{{- end }} | ||
- command: ${KUBECTL} scale deployment crossplane -n upbound-system --replicas=1 | ||
- script: ${KUBECTL} -n upbound-system get deploy --no-headers -o custom-columns=":metadata.name" | grep "provider-" | xargs ${KUBECTL} -n upbound-system scale deploy --replicas=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This assert file belongs to the resource delete step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: {{ .TestCase.Timeout }} | ||
commands: | ||
- script: echo "Dump MR manifests for the delete assertion step:"; ${KUBECTL} get managed -o yaml | ||
- script: echo "Dump Claim manifests for the delete assertion step:" || ${KUBECTL} get claim --all-namespaces -o yaml | ||
{{- range $resource := .Resources }} | ||
{{- if eq $resource.KindGroup "secret." -}} | ||
{{continue}} | ||
{{- end -}} | ||
{{- if $resource.Namespace }} | ||
- script: ${KUBECTL} wait {{ $resource.KindGroup }}/{{ $resource.Name }} --for=delete --timeout 10s --namespace {{ $resource.Namespace }} | ||
{{- else }} | ||
- command: ${KUBECTL} wait {{ $resource.KindGroup }}/{{ $resource.Name }} --for=delete --timeout 10s | ||
{{- end }} | ||
{{- end }} | ||
- command: ${KUBECTL} wait managed --all --for=delete --timeout 10s | ||
{{- if .TestCase.TeardownScriptPath }} | ||
- command: {{ .TestCase.TeardownScriptPath }} | ||
{{- end }} |
1 change: 1 addition & 0 deletions
1
internal/templates/01-delete.yaml.tmpl → internal/templates/03-delete.yaml.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# This file belongs to the resource delete step. | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.