Files
dokku-redis/tests/service_export.bats
Jose Diaz-Gonzalez 919832ba2a Implement AUTH. Closes #58
This change makes password authentication required
for redis usage, and removes anonymous access. Users
will need to change their underlying clients to enable
writing the auth token for authenticating, otherwise
requests will fail.

This is a non-optional change, and improves security
for users who wish to expose their redis installations
outside of their network.
2016-09-21 01:44:57 -06:00

41 lines
1.2 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 with SSH_TTY" {
export ECHO_DOCKER_COMMAND="true"
export SSH_TTY=`tty`
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
assert_exit_status 0
assert_output "docker exec dokku.redis.l cat /data/dump.rdb"
}
@test "($PLUGIN_COMMAND_PREFIX:export) success without SSH_TTY" {
export ECHO_DOCKER_COMMAND="true"
unset SSH_TTY
run dokku "$PLUGIN_COMMAND_PREFIX:export" l
password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")"
assert_exit_status 0
assert_output "docker exec dokku.redis.l cat /data/dump.rdb"
}