feat: warn and exit non-zero when attempting to rebuild from a non-existent branch

Closes #4898
This commit is contained in:
Jose Diaz-Gonzalez
2022-04-02 04:22:44 -04:00
parent 5fc738f001
commit 68c0d7e964
3 changed files with 42 additions and 9 deletions

View File

@@ -12,6 +12,29 @@ teardown() {
global_teardown
}
@test "(git) push to non-deploy branch" {
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch custom-branch"
echo "output: $output"
echo "status: $status"
assert_success
GIT_REMOTE_BRANCH=custom-branch run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch non-existing-branch"
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku ps:rebuild $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_output_contains "Cannot build from 'non-existing-branch' as there are no commits stored at that branch."
assert_failure
}
@test "(git) deploy specific branch" {
run /bin/bash -c "dokku git:set --global deploy-branch global-branch"
echo "output: $output"