Skip to content

Commit

Permalink
Restore apply resources for scenario2 of upgrade test
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 apply_resources function to enable the 2nd
scenario of the upgrade test work by applying the resources from the old
server version of pipeline. It was preivously renamed and removed in
#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 resources in v1 examples that are
not under beta or no-ci.

part of: #5193
  • Loading branch information
JeromeJu committed Jun 28, 2023
1 parent 7b23f93 commit ea47654
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 18 deletions.
49 changes: 31 additions & 18 deletions test/e2e-tests-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,55 @@ header "Setting up environment"
set +o errexit
set +o pipefail

# First, we will verify if Scenario 1 works.
# Install the previous release.
header "Install the previous release of Tekton pipeline $PREVIOUS_PIPELINE_VERSION"
install_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION
# # First, we will verify if Scenario 1 works.
# # Install the previous release.
# header "Install the previous release of Tekton pipeline $PREVIOUS_PIPELINE_VERSION"
# install_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION

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

# Run the integration tests.
failed=0
go_test_e2e -timeout=20m ./test || failed=1
# # Run the integration tests.
# failed=0
# go_test_e2e -timeout=20m ./test || failed=1

# Run the post-integration tests.
go_test_e2e -tags=examples -timeout=20m ./test/ || failed=1
# # Run the post-integration tests.
# go_test_e2e -tags=examples -timeout=20m ./test/ || failed=1

# Remove all the pipeline CRDs, and clean up the environment for next Scenario.
uninstall_pipeline_crd
uninstall_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION
# # Remove all the pipeline CRDs, and clean up the environment for next Scenario.
# uninstall_pipeline_crd
# uninstall_pipeline_crd_version $PREVIOUS_PIPELINE_VERSION

# Next, we will verify if Scenario 2 works.
# Install the previous release.
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
trap "kubectl delete namespace upgrade" EXIT
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
67 changes: 67 additions & 0 deletions test/upgrade/simpleResources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: tekton.dev/v1
kind: Task
metadata:
name: simple-task
namespace: upgrade
spec:
params:
- name: rsp
type: string
default: "response"
steps:
- name: echo-param
image: alpine
script: |
echo "$(params.rsp)"
- name: check-workspace
image: alpine
script: |
if [ "$(workspaces.workspace.bound)" == "true" ]; then
echo "Workspace provided"
fi
sidecars:
- name: server
image: alpine:3.12.0
command: ['/bin/bash']
workingDir: /foo
script: echo server
workspaces:
- name: workspace
mountPath: /foo
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: simple-pipeline
namespace: upgrade
spec:
description: foo
tasks:
- name: check-workspace
taskSpec:
params:
- name: task1-result
type: string
default: "1"
steps:
- image: alpine
name: check-workspace
script: |
if [ "$(workspaces.workspace.bound)" == "true" ]; then
echo "Workspace provided \n"
echo $(params.task1-result)
fi
timeout: 180s
workspaces:
- name: workspace
finally:
- name: echo-status
taskSpec:
params:
- name: echoStatus
type: string
default: "Succeeded"
steps:
- name: verify-status
image: ubuntu
script: echo $(params.echoStatus)
23 changes: 23 additions & 0 deletions test/upgrade/simpleRuns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: simple-pipelinerun
namespace: upgrade
spec:
pipelineRef:
name: simple-pipeline
workspaces:
- name: workspace
emptyDir: {}
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: simple-taskrun
namespace: upgrade
spec:
taskRef:
name: simple-task
workspaces:
- name: workspace
emptyDir: {}

0 comments on commit ea47654

Please sign in to comment.