Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration testing poc #1730

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .tekton/integration-tests/cypress-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
kind: Pipeline
apiVersion: tekton.dev/v1beta1
metadata:
name: example-pipeline
spec:
params:
- description: 'Snapshot of the application'
name: SNAPSHOT
default: '{"components": [{"name":"test-app", "containerImage": "quay.io/example/repo:latest"}]}'
type: string
tasks:
- name: task-1
description: Placeholder task that prints the Snapshot and outputs standard TEST_OUTPUT
params:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
taskSpec:
params:
- name: SNAPSHOT
results:
- name: TEST_OUTPUT
description: Test output
steps:
- image: registry.redhat.io/openshift4/ose-cli:latest
env:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
script: |
dnf -y install jq

echo -e "Example test task for the Snapshot:\n ${SNAPSHOT}"
# Run custom tests for the given Snapshot here
# After the tests finish, record the overall result in the RESULT variable
RESULT="SUCCESS"

# Output the standardized TEST_OUTPUT result in JSON form
TEST_OUTPUT=$(jq -rc --arg date $(date -u --iso-8601=seconds) --arg RESULT "${RESULT}" --null-input \
'{result: $RESULT, timestamp: $date, failures: 0, successes: 1, warnings: 0}')
echo -n "${TEST_OUTPUT}" | tee $(results.TEST_OUTPUT.path)
- name: cypress-e2e-run
description: Run Cypress E2E tests
taskRef:
name: cypress-e2e
params:
- name: SNAPSHOT
value: $(params.SNAPSHOT)
- name: BONFIRE_IMAGE
type: string
description: The container Bonfire image to use for the tekton tasks
default: quay.io/redhat-services-prod/hcm-eng-prod-tenant/cicd-tools:latest
taskSpec:
params:
- name: SNAPSHOT
- name: BONFIRE_IMAGE
finally:
- name: ephemeral-cleanup
taskSpec:
steps:
- name: release-namespace
image: "$(params.BONFIRE_IMAGE)"
script: |
#!/bin/bash
set -e
echo "Releasing ephemeral namespace"
# this will fail as we don't have credentials to do this for now
release-ns.sh "foo" "bar"
Loading