don't use exit 0 in config functions

This commit is contained in:
Michael Hobbs
2015-09-28 17:44:10 -07:00
parent c941a64eba
commit b49cceefd7
2 changed files with 15 additions and 4 deletions

View File

@@ -102,7 +102,7 @@ config_all() {
[[ "$1" == "config" ]] || set -- "config" "$@" [[ "$1" == "config" ]] || set -- "config" "$@"
config_parse_args "$@" config_parse_args "$@"
config_create "$ENV_FILE" config_create "$ENV_FILE"
is_config_export "$@" && config_export "$DOKKU_CONFIG_TYPE" "$APP" && exit 0 is_config_export "$@" && config_export "$DOKKU_CONFIG_TYPE" "$APP" && return 0
[[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP [[ "$APP" ]] && DOKKU_CONFIG_TYPE=$APP
[[ ! -s $ENV_FILE ]] && dokku_log_fail "no config vars for $DOKKU_CONFIG_TYPE" [[ ! -s $ENV_FILE ]] && dokku_log_fail "no config vars for $DOKKU_CONFIG_TYPE"
@@ -112,7 +112,7 @@ config_all() {
for var in "$@"; do for var in "$@"; do
if [[ "$var" == "--shell" ]]; then if [[ "$var" == "--shell" ]]; then
echo $VARS echo $VARS
exit 0 return 0
fi fi
done done
@@ -132,7 +132,7 @@ config_get() {
config_create "$ENV_FILE" config_create "$ENV_FILE"
if [[ ! -s $ENV_FILE ]]; then if [[ ! -s $ENV_FILE ]]; then
exit 0 return 0
fi fi
KEY="$3" KEY="$3"

View File

@@ -11,7 +11,7 @@ teardown() {
} }
@test "(build-env) special characters" { @test "(build-env) special characters" {
run dokku config:set $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)" run dokku config:set --no-restart $TEST_APP NEWRELIC_APP_NAME="$TEST_APP (Staging)"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
@@ -19,3 +19,14 @@ teardown() {
run dokku config $TEST_APP run dokku config $TEST_APP
assert_success assert_success
} }
@test "(build-env) failure" {
run dokku config:set --no-restart $TEST_APP BUILDPACK_URL='https://github.com/dokku/fake-buildpack'
echo "output: "$output
echo "status: "$status
assert_success
run deploy_app
echo "output: "$output
echo "status: "$status
assert_failure
}