diff --git a/pkg/triggers/triggers.go b/pkg/triggers/triggers.go index 9d09aca6..aec6312b 100644 --- a/pkg/triggers/triggers.go +++ b/pkg/triggers/triggers.go @@ -58,6 +58,13 @@ func ExposeEventListner(c *clients.Clients, elname, namespace string) string { return GetRoute(elname, namespace) } +func ExposeDeploymentConfig(c *clients.Clients, elname, port, namespace string) string { + cmd.MustSucceed("oc", "expose", "dc/"+elname, "-n", namespace, "--target-port="+port) + cmd.MustSucceed("oc", "expose", "svc", elname, "-n", namespace, "--target-port="+port) + + return elname +} + func ExposeEventListenerForTLS(c *clients.Clients, elname, namespace string) string { svcName, portName := getServiceNameAndPort(c, elname, namespace) domain := getDomain() diff --git a/specs/ecosystem/ecosystem-s2i.spec b/specs/ecosystem/ecosystem-s2i.spec new file mode 100644 index 00000000..776779db --- /dev/null +++ b/specs/ecosystem/ecosystem-s2i.spec @@ -0,0 +1,166 @@ +PIPELINES-33 +# Verify Ecosystem E2E spec + +Pre condition: + * Validate Operator should be installed + +## S2I nodejs pipelinerun: PIPELINES-33-TC01 +Tags: e2e, ecosystem, non-admin, s2i, sanity +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|-------------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/nodejs-ex-git.yaml | + |2 |testdata/pvc/pvc.yaml | + |3 |testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml | + |4 |testdata/ecosystem/imagestreams/nodejs-ex-git.yaml | + |5 |testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml | + * Verify pipelinerun + |S.NO|pipeline_run_name|status |check_lable_propagation| + |----|-----------------|-----------|-----------------------| + |1 |nodejs-ex-git-pr |successful |no | + * Expose Deployment config "nodejs-ex-git" on port "3000" + * Get route url of the route "nodejs-ex-git" + * Validate that route URL contains "See Also" + +## S2I dotnet pipelinerun: PIPELINES-33-TC02 +Tags: e2e, ecosystem, non-admin, s2i, skip_linux/ppc64le +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-dotnet.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "dotnet" from namespace "openshift" and store to variable "dotnet-tags" + * Start and verify dotnet pipeline "s2i-dotnet-pipeline" with values stored in variable "dotnet-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I golang pipelinerun: PIPELINES-33-TC03 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-go.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "golang" from namespace "openshift" and store to variable "golang-tags" + * Start and verify pipeline "s2i-go-pipeline" with param "VERSION" with values stored in variable "golang-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I java pipelinerun: PIPELINES-33-TC04 +Tags: e2e, ecosystem, non-admin, s2i, sanity +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-java.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "java" from namespace "openshift" and store to variable "java-tags" + * Start and verify pipeline "s2i-java-pipeline" with param "VERSION" with values stored in variable "java-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I nodejs pipelinerun: PIPELINES-33-TC05 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-nodejs.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "nodejs" from namespace "openshift" and store to variable "nodejs-tags" + * Start and verify pipeline "s2i-nodejs-pipeline" with param "VERSION" with values stored in variable "nodejs-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I perl pipelinerun: PIPELINES-33-TC06 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-perl.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "perl" from namespace "openshift" and store to variable "perl-tags" + * Start and verify pipeline "s2i-perl-pipeline" with param "VERSION" with values stored in variable "perl-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I php pipelinerun: PIPELINES-33-TC07 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|---------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-php.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "php" from namespace "openshift" and store to variable "php-tags" + * Start and verify pipeline "s2i-php-pipeline" with param "VERSION" with values stored in variable "php-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I python pipelinerun: PIPELINES-33-TC08 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|------------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-python.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "python" from namespace "openshift" and store to variable "python-tags" + * Start and verify pipeline "s2i-python-pipeline" with param "VERSION" with values stored in variable "python-tags" with workspace "name=source,claimName=shared-pvc" + +## S2I ruby pipelinerun: PIPELINES-33-TC09 +Tags: e2e, ecosystem, non-admin, s2i +Component: Pipelines +Level: Integration +Type: Functional +Importance: Critical + +Steps: + * Verify ServiceAccount "pipeline" exist + * Create + |S.NO|resource_dir | + |----|----------------------------------------------------| + |1 |testdata/ecosystem/pipelines/s2i-ruby.yaml | + |2 |testdata/pvc/pvc.yaml | + * Get tags of the imagestream "ruby" from namespace "openshift" and store to variable "ruby-tags" + * Start and verify pipeline "s2i-ruby-pipeline" with param "VERSION" with values stored in variable "ruby-tags" with workspace "name=source,claimName=shared-pvc" \ No newline at end of file diff --git a/specs/triggers/tutorial.spec b/specs/triggers/tutorial.spec index 67421ca0..37d81bd3 100644 --- a/specs/triggers/tutorial.spec +++ b/specs/triggers/tutorial.spec @@ -37,7 +37,7 @@ Steps: |1 |build-deploy-ui-pipelinerun|successful|no | * Get route url of the route "pipelines-vote-ui" * Wait for pipelines-vote-ui deployment - * Validate route url for pipelines tutorial + * Validate that route URL contains "Cat 🐺 vs Dog 🐶" ## Run pipelines tutorial using triggers: PIPELINES-06-TC02 Tags: e2e, integration, triggers, non-admin, tutorial, sanity @@ -72,4 +72,4 @@ Steps: * Verify the latest pipelinerun for "successful" state * Get route url of the route "pipelines-vote-ui" * Wait for pipelines-vote-ui deployment - * Validate route url for pipelines tutorial + * Validate that route URL contains "Cat 🐺 vs Dog 🐶" diff --git a/steps/triggers/triggers.go b/steps/triggers/triggers.go index 2bc7a744..68eaaa8d 100644 --- a/steps/triggers/triggers.go +++ b/steps/triggers/triggers.go @@ -20,6 +20,10 @@ var _ = gauge.Step("Expose Event listener for TLS ", func(elname string) store.PutScenarioData("elname", elname) }) +var _ = gauge.Step("Expose Deployment config on port ", func(elname, port string) { + triggers.ExposeDeploymentConfig(store.Clients(), elname, port, store.Namespace()) +}) + var _ = gauge.Step("Mock post event with empty payload", func() { gauge.GetScenarioStore()["response"] = triggers.MockPostEventWithEmptyPayload(store.GetScenarioData("route")) }) diff --git a/steps/utility/utility.go b/steps/utility/utility.go index 754865db..8dd14c42 100644 --- a/steps/utility/utility.go +++ b/steps/utility/utility.go @@ -42,13 +42,12 @@ var _ = gauge.Step("Switch to project ", func(projectName string) { gauge.GetScenarioStore()["namespace"] = projectName }) -var _ = gauge.Step("Validate route url for pipelines tutorial", func() { - expectedOutput := "Cat 🐺 vs Dog 🐶" +var _ = gauge.Step("Validate that route URL contains ", func(expectedOutput string) { routeUrl := store.GetScenarioData("routeurl") output := cmd.MustSuccedIncreasedTimeout(30*time.Second, "lynx", routeUrl, "--dump").Stdout() - log.Println(output) if !strings.Contains(output, expectedOutput) { testsuit.T.Fail(fmt.Errorf("expected:\n%v,\ngot:\n%v", expectedOutput, output)) + log.Println(output) } }) diff --git a/tc_spec_map.json b/tc_spec_map.json index c03b9eb3..e1bb1cd6 100644 --- a/tc_spec_map.json +++ b/tc_spec_map.json @@ -30,5 +30,6 @@ "PIPELINES-29": "specs/ecosystem/ecosystem.spec", "PIPELINES-30": "specs/pac/pac-gitlab.spec", "PIPELINES-31": "specs/pipelines/http-resolvers.spec", - "PIPELINES-32": "specs/ecosystem/ecosystem-multiarch.spec" + "PIPELINES-32": "specs/ecosystem/ecosystem-multiarch.spec", + "PIPELINES-33": "specs/ecosystem/ecosystem-s2i.spec" } diff --git a/testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml b/testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml new file mode 100644 index 00000000..8a7b7f81 --- /dev/null +++ b/testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml @@ -0,0 +1,31 @@ +kind: DeploymentConfig +apiVersion: apps.openshift.io/v1 +metadata: + name: nodejs-ex-git + labels: + app: nodejs-ex-git +spec: + strategy: + type: Rolling + triggers: + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - nodejs-ex-git + from: + kind: ImageStreamTag + name: 'nodejs-ex-git:latest' + - type: ConfigChange + replicas: 1 + template: + metadata: + name: nodejs-ex-git + labels: + app: nodejs-ex-git + spec: + containers: + - name: nodejs-ex-git + ports: + - containerPort: 8080 + protocol: TCP \ No newline at end of file diff --git a/testdata/ecosystem/imagestreams/nodejs-ex-git.yaml b/testdata/ecosystem/imagestreams/nodejs-ex-git.yaml new file mode 100644 index 00000000..7858f467 --- /dev/null +++ b/testdata/ecosystem/imagestreams/nodejs-ex-git.yaml @@ -0,0 +1,4 @@ +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: nodejs-ex-git \ No newline at end of file diff --git a/testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml b/testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml new file mode 100644 index 00000000..6a9681c0 --- /dev/null +++ b/testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml @@ -0,0 +1,16 @@ +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: nodejs-ex-git-pr +spec: + pipelineRef: + name: nodejs-ex-git + workspaces: + - name: workspace + volumeClaimTemplate: + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/testdata/ecosystem/pipelines/nodejs-ex-git.yaml b/testdata/ecosystem/pipelines/nodejs-ex-git.yaml new file mode 100644 index 00000000..63660110 --- /dev/null +++ b/testdata/ecosystem/pipelines/nodejs-ex-git.yaml @@ -0,0 +1,82 @@ +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: nodejs-ex-git +spec: + params: + - name: APP_NAME + default: nodejs-ex-git + - name: GIT_REPO + default: 'https://github.com/digitalocean/sample-nodejs.git' + - name: GIT_REVISION + default: master + - name: IMAGE_NAME + default: "image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/nodejs-ex-git" + - name: PATH_CONTEXT + default: . + - name: VERSION + default: latest + tasks: + - name: fetch-repository + params: + - name: URL + value: $(params.GIT_REPO) + - name: revision + value: $(params.GIT_REVISION) + - name: subdirectory + value: '' + - name: deleteExisting + value: 'true' + taskRef: + resolver: cluster + params: + - name: kind + value: task + - name: name + value: git-clone + - name: namespace + value: openshift-pipelines + workspaces: + - name: output + workspace: workspace + - name: build + params: + - name: IMAGE + value: $(params.IMAGE_NAME) + - name: TLSVERIFY + value: 'false' + - name: PATH_CONTEXT + value: $(params.PATH_CONTEXT) + - name: VERSION + value: $(params.VERSION) + runAfter: + - fetch-repository + taskRef: + resolver: cluster + params: + - name: kind + value: task + - name: name + value: s2i-nodejs + - name: namespace + value: openshift-pipelines + workspaces: + - name: source + workspace: workspace + - name: deploy + params: + - name: SCRIPT + value: oc rollout status dc/$(params.APP_NAME) + runAfter: + - build + taskRef: + resolver: cluster + params: + - name: kind + value: task + - name: name + value: openshift-client + - name: namespace + value: openshift-pipelines + workspaces: + - name: workspace \ No newline at end of file diff --git a/testdata/ecosystem/pipelines/s2i-php.yaml b/testdata/ecosystem/pipelines/s2i-php.yaml index afffcedc..66f39707 100644 --- a/testdata/ecosystem/pipelines/s2i-php.yaml +++ b/testdata/ecosystem/pipelines/s2i-php.yaml @@ -25,6 +25,8 @@ spec: params: - name: URL value: https://github.com/sclorg/s2i-php-container + - name: REVISION + value: master - name: SUBDIRECTORY value: s2i-php-$(params.VERSION) - name: DELETE_EXISTING