Files
dokku-mongo/tests/service_expose.bats
2019-03-09 16:39:34 -05:00

31 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bats
load test_helper
setup() {
dokku "$PLUGIN_COMMAND_PREFIX:create" l >&2
}
teardown() {
dokku --force "$PLUGIN_COMMAND_PREFIX:destroy" l >&2
}
@test "($PLUGIN_COMMAND_PREFIX:expose) error when there are no arguments" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose"
assert_contains "${lines[*]}" "Please specify a valid name for the service"
}
@test "($PLUGIN_COMMAND_PREFIX:expose) error when service does not exist" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" not_existing_service
assert_contains "${lines[*]}" "service not_existing_service does not exist"
}
@test "($PLUGIN_COMMAND_PREFIX:expose) success when not providing custom ports" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" l
[[ "${lines[*]}" =~ exposed\ on\ port\(s\)\ \[container\-\>host\]\:\ [[:digit:]]+ ]]
}
@test "($PLUGIN_COMMAND_PREFIX:expose) success when providing custom ports" {
run dokku "$PLUGIN_COMMAND_PREFIX:expose" l 4242 4243 4244 4245
assert_contains "${lines[*]}" "exposed on port(s) [container->host]: 27017->4242 27018->4243 27019->4244 28017->4245"
}