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!
76 lines
2.3 KiB
Bash
Executable File
76 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
load test_helper
|
|
|
|
setup() {
|
|
dokku "$PLUGIN_COMMAND_PREFIX:create" l
|
|
}
|
|
|
|
teardown() {
|
|
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) error when there are no arguments" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info"
|
|
assert_contains "${lines[*]}" "Please specify a valid name for the service"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) error when service does not exist" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" not_existing_service
|
|
assert_contains "${lines[*]}" "service not_existing_service does not exist"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) success" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l
|
|
local password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
|
assert_contains "${lines[*]}" "mysql://mysql:$password@dokku-mysql-l:3306/l"
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) replaces underscores by dash in hostname" {
|
|
dokku "$PLUGIN_COMMAND_PREFIX:create" test_with_underscores
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" test_with_underscores
|
|
local password="$(sudo cat "$PLUGIN_DATA_ROOT/test_with_underscores/PASSWORD")"
|
|
assert_contains "${lines[*]}" "mysql://mysql:$password@dokku-mysql-test-with-underscores:3306/test_with_underscores"
|
|
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" test_with_underscores
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) success with flag" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --dsn
|
|
local password="$(sudo cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
|
assert_output "mysql://mysql:$password@dokku-mysql-l:3306/l"
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --config-dir
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --data-dir
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --dsn
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --exposed-ports
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --id
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --internal-ip
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --links
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --service-root
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --status
|
|
assert_success
|
|
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --version
|
|
assert_success
|
|
}
|
|
|
|
@test "($PLUGIN_COMMAND_PREFIX:info) error when invalid flag" {
|
|
run dokku "$PLUGIN_COMMAND_PREFIX:info" l --invalid-flag
|
|
assert_failure
|
|
}
|