Files
dokku/tests/unit/nginx-vhosts_3.bats
Jose Diaz-Gonzalez a1c768b9b3 refactor: drop web installer in favor of setup via cli
This makes the installation a bit more secure by ensuring a user does not accidentally expose a way for unauthorized users to add new ssh keys to the system.

Additionally, this removes the extra HOSTNAME file to make the initial install process easier (that file was not modifiable by any dokku commands.

Closes #2247
2021-08-07 16:36:41 -04:00

40 lines
1.4 KiB
Bash

#!/usr/bin/env bats
load test_helper
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
setup() {
global_setup
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -fp "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
create_app
docker build "${BATS_TEST_DIRNAME}/../../tests/apps/gogrpc" -t ${TEST_APP}-docker-image
}
teardown() {
destroy_app 0 $TEST_APP
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
global_teardown
}
@test "(nginx-vhosts) grpc endpoint" {
deploy_app gogrpc
dokku proxy:ports-add "$TEST_APP" "grpc:80:50051"
run /bin/bash -c "docker run --rm ${TEST_APP}-docker-image /go/bin/greeter_client -address ${TEST_APP}.dokku.me:80 -name grpc"
assert_output "Greeting: Hello grpc"
}
@test "(nginx-vhosts) grpc endpoint on a port other than 80" {
deploy_app gogrpc
dokku proxy:ports-add "$TEST_APP" "grpc:8080:50051"
run /bin/bash -c "docker run --rm ${TEST_APP}-docker-image /go/bin/greeter_client -address ${TEST_APP}.dokku.me:8080 -name grpc8080"
assert_output "Greeting: Hello grpc8080"
}
@test "(nginx-vhosts) grpcs endpoint" {
setup_test_tls
deploy_app gogrpc
dokku proxy:ports-add "$TEST_APP" "grpcs:443:50051"
run /bin/bash -c "docker run --rm ${TEST_APP}-docker-image /go/bin/greeter_client -address ${TEST_APP}.dokku.me:443 -name grpcs -tls"
assert_output "Greeting: Hello grpcs"
}