tests: correct test issues

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-10 02:54:31 -05:00
parent 7357579af2
commit aa6a651f1d
9 changed files with 17 additions and 38 deletions

View File

@@ -8,7 +8,7 @@ cmd-urls() {
declare cmd="url"
declare APP="$2"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
get_app_urls "$@"
}

View File

@@ -10,7 +10,7 @@ cmd-docker-options-add() {
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
verify_app_name "$2"
verify_app_name "$APP"
read -ra passed_phases <<<"$(get_phases "$2")"
shift 2 # everything else passed is the docker option
local passed_docker_option="$*"

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-ssh-keys-list() {
declare desc="List ssh key hashes"
declare cmd="ssh-keys:list"
[[ "$1" == "$cmd" ]] && shift 1
verify_ssh_key_file
sshcommand list dokku
}

View File

@@ -2,6 +2,15 @@
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions"
cmd-ssh-keys-list() {
declare desc="List ssh key hashes"
declare cmd="ssh-keys:list"
[[ "$1" == "$cmd" ]] && shift 1
verify_ssh_key_file
sshcommand list dokku
}
cmd-ssh-keys-list "$@"

View File

@@ -12,7 +12,9 @@ cmd-storage-mount() {
declare APP="$1" MOUNT_PATH="$2"
local passed_phases=(deploy run)
[[ -z "$APP" || "$MOUNT_PATH" ]] && dokku_log_fail "storage:mount requires an app and a two paths divided by colon."
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$MOUNT_PATH" ]] && dokku_log_fail "Please specify two paths delimited by colon."
verify_app_name "$APP"
verify_paths "$MOUNT_PATH"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" && dokku_log_fail "Mount path already exists."

View File

@@ -12,7 +12,8 @@ cmd-storage-unmount() {
declare APP="$1" MOUNT_PATH="$2"
local passed_phases=(deploy run)
[[ -z "$APP" || "$MOUNT_PATH" ]] && dokku_log_fail "storage:unmount requires an app and a two paths divided by colon."
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
[[ -z "$MOUNT_PATH" ]] && dokku_log_fail "Please specify two paths delimited by colon."
verify_app_name "$APP"
verify_paths "$MOUNT_PATH"
check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" || dokku_log_fail "Mount path does not exist."

View File

@@ -19,17 +19,10 @@ teardown() {
}
@test "(config) config:help" {
run /bin/bash -c "dokku config"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage global and app-specific config vars"
help_output="$output"
run /bin/bash -c "dokku config:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage global and app-specific config vars"
assert_output "$help_output"
}
@test "(config) config:set --global" {

View File

@@ -13,17 +13,10 @@ teardown() {
}
@test "(events) events:help" {
run /bin/bash -c "dokku events"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage event logging"
help_output="$output"
run /bin/bash -c "dokku events:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage event logging"
assert_output "$help_output"
}
@test "(events) check conffiles" {

View File

@@ -13,17 +13,10 @@ teardown() {
}
@test "(tags) tags:help" {
run /bin/bash -c "dokku tags"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage docker image tags"
help_output="$output"
run /bin/bash -c "dokku tags:help"
echo "output: $output"
echo "status: $status"
assert_output_contains "Manage docker image tags"
assert_output "$help_output"
}
@test "(tags) tags:create, tags, tags:destroy" {