Add tests for connect-admin

This commit is contained in:
Jose Diaz-Gonzalez
2016-07-24 14:40:04 -04:00
parent e823af5e7f
commit 6fb3589833
2 changed files with 29 additions and 1 deletions

View File

@@ -27,4 +27,3 @@ teardown() {
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
assert_output "docker exec -i -t dokku.mongo.l mongo -u l -p $password --authenticationDatabase l l"
}

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bats
load test_helper
setup() {
export ECHO_DOCKER_COMMAND="false"
dokku "$PLUGIN_COMMAND_PREFIX:create" l >&2
}
teardown() {
export ECHO_DOCKER_COMMAND="false"
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l >&2
}
@test "($PLUGIN_COMMAND_PREFIX:connect-admin) error when there are no arguments" {
run dokku "$PLUGIN_COMMAND_PREFIX:connect-admin"
assert_contains "${lines[*]}" "Please specify a name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:connect-admin) error when service does not exist" {
run dokku "$PLUGIN_COMMAND_PREFIX:connect-admin" not_existing_service
assert_contains "${lines[*]}" "service not_existing_service does not exist"
}
@test "($PLUGIN_COMMAND_PREFIX:connect-admin) success" {
export ECHO_DOCKER_COMMAND="true"
run dokku "$PLUGIN_COMMAND_PREFIX:connect-admin" l
password="$(cat "$PLUGIN_DATA_ROOT/l/ROOTPASSWORD")"
assert_output "docker exec -i -t dokku.mongo.l mongo -u admin -p $password --authenticationDatabase admin l"
}