-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tekton): adds e2e tests for Tekton tasks (#738)
Co-authored-by: Bartosz Majsak <[email protected]>
- Loading branch information
1 parent
b5921f1
commit 2bd4928
Showing
28 changed files
with
227 additions
and
132 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,5 +86,6 @@ issues: | |
- errcheck | ||
- dupl | ||
- gosec | ||
- path: _suite_test\.go | ||
linters: | ||
- unused | ||
|
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
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,30 @@ | ||
package infra | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/onsi/ginkgo" | ||
|
||
"github.com/maistra/istio-workspace/test/shell" | ||
) | ||
|
||
// TaskIsDone checks if given task has succeeded. | ||
func TaskIsDone(ns, taskName string) func() bool { | ||
return func() bool { | ||
taskRunStatus := shell.ExecuteInDir(".", "kubectl", "get", "taskruns", taskName, "-n", ns, "-o", "jsonpath='{.status.conditions[?(.type==\"Succeeded\")].reason}'") | ||
<-taskRunStatus.Done() | ||
status := strings.Join(taskRunStatus.Status().Stdout, "") | ||
if strings.Contains(status, "Failed") { | ||
<-shell.ExecuteInDir(".", "kubectl", "get", "taskruns", taskName, "-n", ns, "-o", "yaml").Done() | ||
ginkgo.Fail("Expected " + taskName + " to succeed") | ||
} | ||
return strings.Contains(status, "Succeeded") | ||
} | ||
} | ||
|
||
// TaskResult returns value of given result variable for defined Task. | ||
func TaskResult(ns, taskName, key string) string { | ||
taskResultStatus := shell.ExecuteInDir(".", "kubectl", "get", "taskruns", taskName, "-n", ns, "-o", "jsonpath={.status.taskResults[?(.name==\""+key+"\")].value}") | ||
<-taskResultStatus.Done() | ||
return strings.Join(taskResultStatus.Status().Stdout, "") | ||
} |
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
34 changes: 17 additions & 17 deletions
34
integration/tekton/tasks/ike-create/samples/ike-create.yaml
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,17 +1,17 @@ | ||
name: preview-customer | ||
taskRef: | ||
name: ike-create | ||
kind: Task | ||
runAfter: | ||
- image-customer | ||
params: | ||
- name: session | ||
value: $(params.git-pr-head-ref) | ||
- name: target | ||
value: customer-v1 | ||
- name: route | ||
value: "header:ike-session-id=$(params.git-pr-head-ref)" | ||
- name: namespace | ||
value: workspace-demo | ||
- name: image | ||
value: image-registry.openshift-image-registry.svc:5000/workspace-demo/$(params.git-repo-name)-customer:$(params.git-revision) | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
name: ike-create-run | ||
spec: | ||
serviceAccountName: istio-workspace | ||
taskRef: | ||
name: ike-create | ||
params: | ||
- name: target | ||
value: ratings-v1 | ||
- name: session | ||
value: $(params.git-pr-head-ref) | ||
- name: image | ||
value: quay.io/workspace-demo/$(params.git-repo-name)-ratings:$(params.git-revision) | ||
- name: route | ||
value: "header:ike-session-id=$(params.git-pr-head-ref)" |
1 change: 0 additions & 1 deletion
1
integration/tekton/tasks/ike-create/tests/pre-apply-task-hook.sh
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.