Files
dokku-mongo/tests/service_export.bats
Jacob Williams 179b4984a3 Redirect mongodump stdout to stderr
In version 3.x, the output of mongodump is on stderr, but on 2.6.x
it writes information to stdout. This change doesn't break 3.x in
my tests but prevents extraneous junk in beginning of the tar file
when exporting in 2.6.x.

Updated test to match redirect in exec command.
2015-12-07 23:59:55 -06:00

31 lines
1.0 KiB
Bash
Executable File

#!/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:export) error when there are no arguments" {
run dokku "$PLUGIN_COMMAND_PREFIX:export"
assert_contains "${lines[*]}" "Please specify a name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:export) error when service does not exist" {
run dokku "$PLUGIN_COMMAND_PREFIX:export" not_existing_service
assert_contains "${lines[*]}" "service not_existing_service does not exist"
}
@test "($PLUGIN_COMMAND_PREFIX:export) success" {
export ECHO_DOCKER_COMMAND="true"
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
assert_output "docker exec dokku.mongo.l bash -c DIR=\$(mktemp -d) && mongodump -d l -o \"\$DIR\" -u \"l\" -p \"$password\" --authenticationDatabase \"l\" 1>&2 && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\""
}