From e4b0fddd3791a46865a92063be3f03c42bc3eecc Mon Sep 17 00:00:00 2001 From: 16yuki0702 Date: Wed, 4 Sep 2019 14:38:04 +0900 Subject: [PATCH 1/2] Add deletion scenario to e2e test --- test/e2e-common.sh | 2 +- test/e2e-tests.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/test/e2e-common.sh b/test/e2e-common.sh index 8d95a94afd..902b382dc3 100755 --- a/test/e2e-common.sh +++ b/test/e2e-common.sh @@ -199,7 +199,7 @@ run_test() { local desc="$1"; shift echo "Running $@" - $@ || fail_test "failed to $desc" + "$@" || fail_test "failed to $desc" echo } diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 83dc3ea7fd..d3c1b2b44f 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -111,4 +111,42 @@ run_test "show logs" tkn taskrun logs test-template-volume run_test "list pipelineresources" tkn resource list run_test "describe pipelineresource" tkn resource desc skaffold-git +# delete pipeline, pipelinerun, task, taskrun, and pipelineresource +run_test "delete pipeline" expect -c " + spawn tkn pipeline delete output-pipeline + expect \"Are you sure you want to delete pipeline "output-pipeline" (y/n): \" + send \"y\n\" + expect \"Pipeline deleted: output-pipeline\" + " +run_test "delete pipelinerun" expect -c " + spawn tkn pipelinerun delete output-pipeline-run + expect \"Are you sure you want to delete pipelinerun "output-pipeline-run" (y/n): \" + send \"y\n\" + expect \"PipelineRun deleted: output-pipeline-run\" + " +run_test "delete resource" expect -c " + spawn tkn resource delete skaffold-git + expect \"Are you sure you want to delete pipelineresource "skaffold-git" (y/n): \" + send \"y\n\" + expect \"PipelineResource deleted: skaffold-git\" + " +run_test "delete task" expect -c " + spawn tkn task delete create-file + expect \"Are you sure you want to delete task "create-file" (y/n): \" + send \"y\n\" + expect \"Task deleted: create-file\" + " +run_test "delete taskrun" expect -c " + spawn tkn taskrun delete test-template-volume + expect \"Are you sure you want to delete taskrun "test-template-volume" (y/n): \" + send \"y\n\" + expect \"TaskRun deleted: test-template-volume\" + " + +# confirm deletion (TODO: Add task test when added desc or logs to task command) +must_fail "describe deleted pipeline" tkn pipeline describe output-pipeline +must_fail "describe deleted pipelinerun" tkn pipelinerun describe output-pipeline-run +must_fail "describe deleted resource" tkn resource describe skaffold-git +must_fail "show logs deleted taskrun" tkn taskrun logs test-template-volume + success From d736981ea09459065121eae555648aef846f0ace Mon Sep 17 00:00:00 2001 From: 16yuki0702 Date: Thu, 5 Sep 2019 11:07:13 +0900 Subject: [PATCH 2/2] Fix to use -f flag --- test/e2e-tests.sh | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index d3c1b2b44f..1b24e5ade8 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -112,36 +112,11 @@ run_test "list pipelineresources" tkn resource list run_test "describe pipelineresource" tkn resource desc skaffold-git # delete pipeline, pipelinerun, task, taskrun, and pipelineresource -run_test "delete pipeline" expect -c " - spawn tkn pipeline delete output-pipeline - expect \"Are you sure you want to delete pipeline "output-pipeline" (y/n): \" - send \"y\n\" - expect \"Pipeline deleted: output-pipeline\" - " -run_test "delete pipelinerun" expect -c " - spawn tkn pipelinerun delete output-pipeline-run - expect \"Are you sure you want to delete pipelinerun "output-pipeline-run" (y/n): \" - send \"y\n\" - expect \"PipelineRun deleted: output-pipeline-run\" - " -run_test "delete resource" expect -c " - spawn tkn resource delete skaffold-git - expect \"Are you sure you want to delete pipelineresource "skaffold-git" (y/n): \" - send \"y\n\" - expect \"PipelineResource deleted: skaffold-git\" - " -run_test "delete task" expect -c " - spawn tkn task delete create-file - expect \"Are you sure you want to delete task "create-file" (y/n): \" - send \"y\n\" - expect \"Task deleted: create-file\" - " -run_test "delete taskrun" expect -c " - spawn tkn taskrun delete test-template-volume - expect \"Are you sure you want to delete taskrun "test-template-volume" (y/n): \" - send \"y\n\" - expect \"TaskRun deleted: test-template-volume\" - " +run_test "delete pipeline" tkn pipeline delete output-pipeline -f +run_test "delete pipelinerun" tkn pipelinerun delete output-pipeline-run -f +run_test "delete resource" tkn resource delete skaffold-git -f +run_test "delete task" tkn task delete create-file -f +run_test "delete taskrun" tkn taskrun delete test-template-volume -f # confirm deletion (TODO: Add task test when added desc or logs to task command) must_fail "describe deleted pipeline" tkn pipeline describe output-pipeline