Skip to content

Commit

Permalink
Restore Upgrade Test Scenario2 by creating resources
Browse files Browse the repository at this point in the history
Scenario 2 of the upgrade test aims to install pipeline server from the
preivous release, create resources from that version and test on those
resources against the client of the current release.

This commit restores the resources creation of simple Task and Pipeline
resources to enable the 2nd scenario of the upgrade test to work by
applying the resources from the old server version of pipeline. It was
preivously renamed and removed in tektoncd#2685.

It fixes the missing piece where the required resources from the previous
release have not been created to accomplish scenario 2 of the upgrade
test. More specifically, it creates a simple Task and Pipeline resources
and then runs the two simple resources with a TaskRun and PipelineRun
created after upgrading to the current version and verify that they both
run successfully.

/kind misc
Closes tektoncd#6868
  • Loading branch information
JeromeJu committed Jun 28, 2023
1 parent 7b23f93 commit 56b2e17
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 3 deletions.
18 changes: 15 additions & 3 deletions test/e2e-tests-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,29 @@ uninstall_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION
header "Install the previous release of Tekton pipeline $PREVIOUS_PIPELINE_VERSION"
install_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION

header "Create resources at previous release version"
kubectl create namespace upgrade
kubectl create -f ./test/upgrade/simpleResources.yaml

# Upgrade to the current release.
header "Upgrade to the current release of Tekton pipeline"
install_pipeline_crd

# Run the integration tests.
go_test_e2e -timeout=20m ./test || failed=1
header "Start runs upon resources created at current release version"
kubectl create -f ./test/upgrade/simpleRuns.yaml

# Run the post-integration tests. We do not need to install the resources again, since
# they are installed before the upgrade. We verify if they still work, after going through
# the upgrade.
go_test_e2e -tags=examples -timeout=20m ./test/ || failed=1
for test in taskrun pipelinerun; do
header "Running YAML e2e tests for ${test}s"
if ! run_tests ${test}; then
echo "ERROR: one or more YAML tests failed"
output_yaml_test_results ${test}
output_pods_logs ${test}
failed=1
fi
done

(( failed )) && fail_test

Expand Down
76 changes: 76 additions & 0 deletions test/upgrade/simpleResources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: simple-task
namespace: upgrade
spec:
steps:
- name: step
image: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
command: ['/bin/bash']
workingDir: /dir
stepTemplate:
image: gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
command: ['/bin/bash']
sidecars:
- name: server
image: alpine/git:v2.26.2
command: ['/bin/bash']
workingDir: /dir
script: echo test
volumes:
- name: messages
emptyDir: {}
params:
- name: PARAM
description: param des
type: string
default: "1"
workspaces:
- name: workspace
description: description
mountPath: /foo
readOnly: true
optional: true
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: simple-pipeline
namespace: upgrade
spec:
description: foo
tasks:
- name: generate-result
params:
- name: STRING_LENGTH
value: 1
taskSpec:
params:
- name: task1-result
type: string
default: "1"
steps:
- image: alpine
onError: continue
name: exit-with-255
script: |
exit 255
timeout: 60s
workspaces:
- name: empty-dir
finally:
- name: echo-status
taskSpec:
params:
- name: echoStatus
type: string
default: "status"
steps:
- name: verify-status
image: ubuntu
script: |
if [ $(params.echoStatus) == "Succeeded" ]
then
echo " Good night! echoed successfully"
fi
20 changes: 20 additions & 0 deletions test/upgrade/simpleRuns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: simple-pipelinerun
namespace: upgrade
spec:
pipelineRef:
name: simple-pipeline
workspaces:
- name: empty-dir
emptyDir: {}
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: simple-taskrun
namespace: upgrade
spec:
taskRef:
name: simple-task

0 comments on commit 56b2e17

Please sign in to comment.