From f0a647053b200ea6e57d96cdaa65f4ae3c5b66cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Tue, 29 Sep 2015 18:51:49 +0200 Subject: [PATCH] Replace underscore by dash in exposed hostname Fixes #28 --- functions | 2 +- tests/service_info.bats | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/functions b/functions index 9280610..32ae3b9 100755 --- a/functions +++ b/functions @@ -33,7 +33,7 @@ verify_service_name() { service_alias() { local SERVICE="$1" local SERVICE_NAME=$(get_service_name "$SERVICE") - echo "$SERVICE_NAME" | tr . - + echo "$SERVICE_NAME" | tr ._ - } service_info() { diff --git a/tests/service_info.bats b/tests/service_info.bats index ba4cca1..df4cb19 100755 --- a/tests/service_info.bats +++ b/tests/service_info.bats @@ -24,3 +24,11 @@ teardown() { password="$(cat "$PLUGIN_DATA_ROOT/l/PASSWORD")" assert_contains "${lines[*]}" "DSN: postgres://postgres:$password@dokku-postgres-l:5432/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 + password="$(cat "$PLUGIN_DATA_ROOT/test_with_underscores/PASSWORD")" + assert_contains "${lines[*]}" "DSN: postgres://postgres:$password@dokku-postgres-test-with-underscores:5432/test_with_underscores" + dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" test_with_underscores +}