Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deletion scenario to e2e test #279

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ run_test() {
local desc="$1"; shift

echo "Running $@"
$@ || fail_test "failed to $desc"
"$@" || fail_test "failed to $desc"
echo
}

Expand Down
38 changes: 38 additions & 0 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to be more simple using -f flag??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine with -f but doing with -f is extra better , you can perhaps move a lot of it to a generic shell function to simplify it,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can perhaps move a lot of it to a generic shell function to simplify it,

thanks!! I'll try it.

Copy link
Member Author

@16yuki0702 16yuki0702 Sep 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... Test conainter image seems not to have expect command so I fix to use -f flag for now.
I think we can choose another way to this like below, any ideas?

  1. find a way use another command that has the same functionality as the expect command. (but I have no idea for now sorry 😓)
  2. Include expect command in test container image (Could it?)

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