fix: add test for warning on pushing to wrong branch

Closes #3592
This commit is contained in:
Jose Diaz-Gonzalez
2019-08-01 20:53:24 -04:00
parent ba5b5d4596
commit 5000c32efe
2 changed files with 9 additions and 3 deletions

View File

@@ -143,12 +143,12 @@ git_hook_cmd() {
# shellcheck disable=SC2086
git_receive_app "$APP" "$newrev"
else
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 0 ]]; then
if [[ $(find "$PLUGIN_PATH"/enabled/*/receive-branch 2>/dev/null | wc -l) != 1 ]]; then
# shellcheck disable=SC2086
plugn trigger receive-branch $APP $newrev $refname
else
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\//}:master'"
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to ${DOKKU_DEPLOY_BRANCH}."
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\//}:${DOKKU_DEPLOY_BRANCH}'"
fi
fi
done

View File

@@ -28,6 +28,12 @@ teardown() {
echo "status: $status"
assert_success
run deploy_app
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "deploy did not complete"
run /bin/bash -c "dokku git:set $TEST_APP deploy-branch app-branch"
GIT_REMOTE_BRANCH=app-branch deploy_app
echo "output: $output"