From 3bffa6087ffff90236461e956d6eefdd9f8d4b9e Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Thu, 16 Jul 2020 12:14:30 +0530 Subject: [PATCH] Update e2e scipts according to new structure This will update the e2e scripts to run tests according to new catalog structure after reorg Ignore cloudevent test as it is not working for now Fix #420 --- task/buildah/0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- .../jib-gradle/0.1/tests/pre-apply-task-hook.sh | 2 +- task/jib-maven/0.1/tests/pre-apply-task-hook.sh | 2 +- task/kaniko/0.1/tests/pre-apply-task-hook.sh | 2 +- task/maven/0.1/tests/pre-apply-task-hook.sh | 2 +- task/prettier/0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- task/s2i/0.1/tests/pre-apply-task-hook.sh | 2 +- .../0.1/tests/pre-apply-task-hook.sh | 2 +- test/e2e-common.sh | 17 +++++++++++------ test/e2e-tests.sh | 4 ++-- 17 files changed, 28 insertions(+), 23 deletions(-) diff --git a/task/buildah/0.1/tests/pre-apply-task-hook.sh b/task/buildah/0.1/tests/pre-apply-task-hook.sh index d810d148ad..e39fb789ab 100755 --- a/task/buildah/0.1/tests/pre-apply-task-hook.sh +++ b/task/buildah/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/buildpacks-v3/0.1/tests/pre-apply-task-hook.sh b/task/buildpacks-v3/0.1/tests/pre-apply-task-hook.sh index d810d148ad..e39fb789ab 100755 --- a/task/buildpacks-v3/0.1/tests/pre-apply-task-hook.sh +++ b/task/buildpacks-v3/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/golang-build/0.1/tests/pre-apply-task-hook.sh b/task/golang-build/0.1/tests/pre-apply-task-hook.sh index d810d148ad..e39fb789ab 100755 --- a/task/golang-build/0.1/tests/pre-apply-task-hook.sh +++ b/task/golang-build/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/golang-test/0.1/tests/pre-apply-task-hook.sh b/task/golang-test/0.1/tests/pre-apply-task-hook.sh index d810d148ad..e39fb789ab 100755 --- a/task/golang-test/0.1/tests/pre-apply-task-hook.sh +++ b/task/golang-test/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/golangci-lint/0.1/tests/pre-apply-task-hook.sh b/task/golangci-lint/0.1/tests/pre-apply-task-hook.sh index d810d148ad..e39fb789ab 100755 --- a/task/golangci-lint/0.1/tests/pre-apply-task-hook.sh +++ b/task/golangci-lint/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/helm-upgrade-from-repo/0.1/tests/pre-apply-task-hook.sh b/task/helm-upgrade-from-repo/0.1/tests/pre-apply-task-hook.sh index 981275632d..93ca75c4b5 100755 --- a/task/helm-upgrade-from-repo/0.1/tests/pre-apply-task-hook.sh +++ b/task/helm-upgrade-from-repo/0.1/tests/pre-apply-task-hook.sh @@ -1,7 +1,7 @@ #!/bin/bash # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml # Add service account kubectl -n ${tns} create serviceaccount helm-pipeline-run-sa -o yaml --dry-run=client | kubectl apply -f - diff --git a/task/helm-upgrade-from-source/0.1/tests/pre-apply-task-hook.sh b/task/helm-upgrade-from-source/0.1/tests/pre-apply-task-hook.sh index 981275632d..93ca75c4b5 100755 --- a/task/helm-upgrade-from-source/0.1/tests/pre-apply-task-hook.sh +++ b/task/helm-upgrade-from-source/0.1/tests/pre-apply-task-hook.sh @@ -1,7 +1,7 @@ #!/bin/bash # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml # Add service account kubectl -n ${tns} create serviceaccount helm-pipeline-run-sa -o yaml --dry-run=client | kubectl apply -f - diff --git a/task/jib-gradle/0.1/tests/pre-apply-task-hook.sh b/task/jib-gradle/0.1/tests/pre-apply-task-hook.sh index cf2406f8e0..aaa8b5c315 100755 --- a/task/jib-gradle/0.1/tests/pre-apply-task-hook.sh +++ b/task/jib-gradle/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/jib-maven/0.1/tests/pre-apply-task-hook.sh b/task/jib-maven/0.1/tests/pre-apply-task-hook.sh index cf2406f8e0..aaa8b5c315 100755 --- a/task/jib-maven/0.1/tests/pre-apply-task-hook.sh +++ b/task/jib-maven/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/kaniko/0.1/tests/pre-apply-task-hook.sh b/task/kaniko/0.1/tests/pre-apply-task-hook.sh index cf2406f8e0..aaa8b5c315 100755 --- a/task/kaniko/0.1/tests/pre-apply-task-hook.sh +++ b/task/kaniko/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/maven/0.1/tests/pre-apply-task-hook.sh b/task/maven/0.1/tests/pre-apply-task-hook.sh index 2bdaa43459..51a3a68e88 100755 --- a/task/maven/0.1/tests/pre-apply-task-hook.sh +++ b/task/maven/0.1/tests/pre-apply-task-hook.sh @@ -1,4 +1,4 @@ #!/bin/bash # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/prettier/0.1/tests/pre-apply-task-hook.sh b/task/prettier/0.1/tests/pre-apply-task-hook.sh index 2d2fe0ef61..22c79fc1fa 100644 --- a/task/prettier/0.1/tests/pre-apply-task-hook.sh +++ b/task/prettier/0.1/tests/pre-apply-task-hook.sh @@ -1,4 +1,4 @@ #!/bin/bash # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml \ No newline at end of file +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml \ No newline at end of file diff --git a/task/replace-tokens/0.1/tests/pre-apply-task-hook.sh b/task/replace-tokens/0.1/tests/pre-apply-task-hook.sh index 2d2fe0ef61..22c79fc1fa 100644 --- a/task/replace-tokens/0.1/tests/pre-apply-task-hook.sh +++ b/task/replace-tokens/0.1/tests/pre-apply-task-hook.sh @@ -1,4 +1,4 @@ #!/bin/bash # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml \ No newline at end of file +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml \ No newline at end of file diff --git a/task/s2i/0.1/tests/pre-apply-task-hook.sh b/task/s2i/0.1/tests/pre-apply-task-hook.sh index 10268ab386..f17f4b7cb3 100755 --- a/task/s2i/0.1/tests/pre-apply-task-hook.sh +++ b/task/s2i/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ add_sidecar_registry ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/task/upload-pypi/0.1/tests/pre-apply-task-hook.sh b/task/upload-pypi/0.1/tests/pre-apply-task-hook.sh index b92fbd410f..f4a0f5a871 100755 --- a/task/upload-pypi/0.1/tests/pre-apply-task-hook.sh +++ b/task/upload-pypi/0.1/tests/pre-apply-task-hook.sh @@ -5,4 +5,4 @@ cat ${TMPF} | python -c 'import yaml,sys;data=yaml.load(sys.stdin.read());data["spec"]["sidecars"]=[{"image":"pypiserver/pypiserver:latest", "name":"server", "command":["pypi-server","-P",".","-a",".","/data/packages"], "volumeMounts":[{"name":"packages", "mountPath":"/data/packages"}]}];data["spec"]["volumes"]=[{"name":"packages", "emptyDir":{}}];print(yaml.dump(data, default_flow_style=False));' > ${TMPF} # Add git-clone -kubectl -n ${tns} apply -f ./git/git-clone.yaml +kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 0a239b13d0..10ebf5bbd8 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -57,7 +57,7 @@ function test_yaml_can_install() { # Validate that all the Task CRDs in this repo are valid by creating them in a NS. readonly ns="task-ns" kubectl create ns "${ns}" || true - for runtest in $(find ${REPO_ROOT_DIR} -maxdepth 2 -name '*.yaml'); do + for runtest in $(find ${REPO_ROOT_DIR}/task -maxdepth 3 -name '*.yaml'); do skipit= for ignore in ${TEST_YAML_IGNORES};do [[ ${ignore} == $(basename $(echo ${runtest%.yaml})) ]] && skipit=True @@ -89,7 +89,10 @@ function show_failure() { } function test_task_creation() { for runtest in ${@};do - local testname=${runtest%%/*} + # remove task/ from beginning + local runtestdir=${runtest#*/} + # remove /0.1/tests from end + local testname=${runtestdir%%/*} local tns="${testname}-$$" local skipit= local maxloop=60 # 10 minutes max @@ -98,16 +101,18 @@ function test_task_creation() { [[ ${ignore} == ${testname} ]] && skipit=True done - ls ${testname}/*.yaml 2>/dev/null >/dev/null || skipit=True + # remove /tests from end + local taskdir=${runtest%/*} + ls ${taskdir}/*.yaml 2>/dev/null >/dev/null || skipit=True [[ -n ${skipit} ]] && continue kubectl create namespace ${tns} # Install the task itself first - for yaml in ${testname}/*.yaml;do + for yaml in ${taskdir}/*.yaml;do cp ${yaml} ${TMPF} - [[ -f ${testname}/tests/pre-apply-task-hook.sh ]] && source ${testname}/tests/pre-apply-task-hook.sh + [[ -f ${taskdir}/tests/pre-apply-task-hook.sh ]] && source ${taskdir}/tests/pre-apply-task-hook.sh function_exists pre-apply-task-hook && pre-apply-task-hook kubectl -n ${tns} create -f ${TMPF} done @@ -115,7 +120,7 @@ function test_task_creation() { # Install resource and run for yaml in ${runtest}/*.yaml;do cp ${yaml} ${TMPF} - [[ -f ${testname}/tests/pre-apply-taskrun-hook.sh ]] && source ${testname}/tests/pre-apply-taskrun-hook.sh + [[ -f ${taskdir}/tests/pre-apply-taskrun-hook.sh ]] && source ${taskdir}/tests/pre-apply-taskrun-hook.sh function_exists pre-apply-taskrun-hook && pre-apply-taskrun-hook kubectl -n ${tns} create -f ${TMPF} done diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index f2c1769b0e..d550e15096 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -46,12 +46,12 @@ TEST_YAML_IGNORES=${TEST_YAML_IGNORES:-""} # Allow ignoring some yaml tests, space separated, should be the basename of the # test for example "s2i" -TEST_TASKRUN_IGNORES=${TEST_TASKRUN_IGNORES:-""} +TEST_TASKRUN_IGNORES=${TEST_TASKRUN_IGNORES:-"cloudevent"} set -ex set -o pipefail test_yaml_can_install -test_task_creation */tests +test_task_creation task/*/*/tests success