This pull request switches testing to use an actual docker daemon, vs mocking everything out. It may also catch actual breaking issues in our tests, which is great!
54 lines
1.9 KiB
Bash
Executable File
54 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
load test_helper
|
|
|
|
setup() {
|
|
dokku apps:create my_app
|
|
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
|
}
|
|
|
|
teardown() {
|
|
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
|
dokku --force apps:destroy my_app
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when there are no arguments" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:unlink"
|
|
assert_contains "${lines[*]}" "Please specify a valid name for the service"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when the app argument is missing" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" l
|
|
assert_contains "${lines[*]}" "Please specify an app to run the command on"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when the app does not exist" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" l not_existing_app
|
|
assert_contains "${lines[*]}" "App not_existing_app does not exist"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when the service does not exist" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" not_existing_service my_app
|
|
assert_contains "${lines[*]}" "service not_existing_service does not exist"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) error when service not linked to app" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
|
assert_contains "${lines[*]}" "Not linked to app my_app"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) removes link from docker-options" {
|
|
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
|
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
|
|
|
check_value="Docker options build: Docker options deploy: --restart=on-failure:10 Docker options run:"
|
|
options=$(dokku --quiet docker-options:report my_app | xargs)
|
|
assert_equal "$options" "$check_value"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:unlink) unsets config url from app" {
|
|
dokku "$PLUGIN_COMMAND_PREFIX:link" l my_app >&2
|
|
dokku "$PLUGIN_COMMAND_PREFIX:unlink" l my_app
|
|
config=$(dokku config:get my_app DATABASE_URL || true)
|
|
assert_equal "$config" ""
|
|
}
|