Use authentication when creating database
This commit is contained in:
@@ -24,6 +24,7 @@ teardown() {
|
||||
@test "($PLUGIN_COMMAND_PREFIX:connect) success" {
|
||||
export ECHO_DOCKER_COMMAND="true"
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:connect" l
|
||||
assert_output 'docker exec -it dokku.mongo.l mongo l'
|
||||
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_output "docker exec -it dokku.mongo.l mongo -u l -p $password --authenticationDatabase l l"
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ teardown() {
|
||||
@test "($PLUGIN_COMMAND_PREFIX:export) success" {
|
||||
export ECHO_DOCKER_COMMAND="true"
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
|
||||
assert_output "docker exec dokku.mongo.l bash -c DIR=\$(mktemp -d) && mongodump -d l -o=\"\$DIR\" && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\""
|
||||
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\" && tar cf - -C \"\$DIR\" . && rm -rf \"\$DIR\""
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ teardown() {
|
||||
@test "($PLUGIN_COMMAND_PREFIX:import) success" {
|
||||
export ECHO_DOCKER_COMMAND="true"
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:import" l < "$PLUGIN_DATA_ROOT/fake.dump.tar"
|
||||
assert_output "docker exec -i dokku.mongo.l bash -c DIR=\$(mktemp -d) && tar xf - -C \"\$DIR\" && mongorestore -d l \$(find \"\$DIR\" -mindepth 1 -maxdepth 1 -type d | head -n1) && rm -rf \"\$DIR\""
|
||||
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_output "docker exec -i dokku.mongo.l bash -c DIR=\$(mktemp -d) && tar xf - -C \"\$DIR\" && mongorestore -d l -u \"l\" -p \"$password\" --authenticationDatabase \"l\" \$(find \"\$DIR\" -mindepth 1 -maxdepth 1 -type d | head -n1) && rm -rf \"\$DIR\""
|
||||
}
|
||||
|
||||
|
||||
@@ -21,5 +21,6 @@ teardown() {
|
||||
|
||||
@test "($PLUGIN_COMMAND_PREFIX:info) success" {
|
||||
run dokku "$PLUGIN_COMMAND_PREFIX:info" l
|
||||
assert_contains "${lines[*]}" "DSN: mongodb://172.17.0.34:27017/l"
|
||||
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
|
||||
assert_contains "${lines[*]}" "DSN: mongodb://l:$password@172.17.0.34:27017/l"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user