Skip to content

Commit

Permalink
Add comments about the two scenarios for upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Hou authored and tekton-robot committed Aug 30, 2019
1 parent 56147ea commit 3950521
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ To run the YAML e2e tests, run the following command:
### Running upgrade tests
There are two scenarios in upgrade tests. One is to install the previous release, upgrade to the current release, and
validate whether the Tekton pipeline works. The other is to install the previous release, create the pipelines and tasks,
upgrade to the current release, and validate whether the Tekton pipeline works.
To run the upgrade tests, run the following command:
```bash
Expand Down
4 changes: 2 additions & 2 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function install_pipeline_crd() {
# Install the Tekton pipeline crd based on the release number
function install_pipeline_crd_version() {
echo ">> Deploying Tekton Pipelines of Version $1"
kubectl apply -f "https://github.com/tektoncd/pipeline/releases/download/v$1/release.yaml" || fail_test "Build pipeline installation failed of Version $1"
kubectl apply -f "https://github.com/tektoncd/pipeline/releases/download/$1/release.yaml" || fail_test "Build pipeline installation failed of Version $1"
verify_pipeline_installation
}

Expand All @@ -161,7 +161,7 @@ function uninstall_pipeline_crd() {

function uninstall_pipeline_crd_version() {
echo ">> Uninstalling Tekton Pipelines of version $1"
kubectl delete --ignore-not-found=true -f "https://github.com/tektoncd/pipeline/releases/download/v$1/release.yaml"
kubectl delete --ignore-not-found=true -f "https://github.com/tektoncd/pipeline/releases/download/$1/release.yaml"

# Make sure that everything is cleaned up in the current namespace.
for res in conditions pipelineresources tasks pipelines taskruns pipelineruns; do
Expand Down
28 changes: 24 additions & 4 deletions test/e2e-tests-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@
# limitations under the License.

# This script calls out to scripts in tektoncd/plumbing to setup a cluster
# and deploy Tekton Pipelines to it for running integration tests.
# and deploy Tekton Pipelines to it for running upgrading tests. There are
# two scenarios we need to cover in this script:

# Scenario 1: install the previous release, upgrade to the current release, and
# validate whether the Tekton pipeline works.

# Scenario 2: install the previous release, create the pipelines and tasks, upgrade
# to the current release, and validate whether the Tekton pipeline works.

source $(dirname $0)/e2e-common.sh
PREVIOUS_PIPELINE_VERSION=0.5.2
PREVIOUS_PIPELINE_VERSION=v0.5.2

# Script entry point.

Expand All @@ -30,16 +37,20 @@ 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

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

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

# Run the post-integration tests.
for test in taskrun pipelinerun; do
header "Running YAML e2e tests for ${test}s"
if ! run_yaml_tests ${test}; then
Expand All @@ -50,23 +61,32 @@ for test in taskrun pipelinerun; do
fi
done

# Remove all the pipeline CRDs
# 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

# Create the resources of taskrun and pipelinerun, under the directories example/taskrun
# and example/pipelinerun.
for test in taskrun pipelinerun; do
header "Applying the resources ${test}s"
apply_resources ${test}
done

# 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

# 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.
for test in taskrun pipelinerun; do
header "Running YAML e2e tests for ${test}s"
if ! run_tests ${test}; then
Expand Down

0 comments on commit 3950521

Please sign in to comment.