test: ensure that the worker upstream exists

This commit is contained in:
Jose Diaz-Gonzalez
2020-03-13 12:42:42 -04:00
parent 38a13ecd39
commit c4b8bd8da9
2 changed files with 24 additions and 1 deletions

View File

@@ -76,6 +76,7 @@ teardown() {
add_domain "wildcard1.dokku.me"
add_domain "wildcard2.dokku.me"
deploy_app nodejs-express dokku@dokku.me:$TEST_APP custom_ssl_nginx_template
assert_ssl_domain "wildcard1.dokku.me"
assert_ssl_domain "wildcard2.dokku.me"
assert_http_redirect "http://${CUSTOM_TEMPLATE_SSL_DOMAIN}" "https://${CUSTOM_TEMPLATE_SSL_DOMAIN}:443/"
@@ -84,9 +85,23 @@ teardown() {
@test "(nginx-vhosts) nginx:build-config (custom nginx template - no ssl)" {
add_domain "www.test.app.dokku.me"
deploy_app nodejs-express dokku@dokku.me:$TEST_APP custom_nginx_template
run deploy_app nodejs-express dokku@dokku.me:$TEST_APP custom_nginx_template
echo "output: $output"
echo "status: $status"
assert_success
run /bin/bash -c "dokku ps:scale $TEST_APP worker=1"
echo "output: $output"
echo "status: $status"
assert_success
assert_nonssl_domain "www.test.app.dokku.me"
assert_http_success "customtemplate.dokku.me"
run /bin/bash -c "dokku nginx:show-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_output_contains "${TEST_APP}-worker-5000"
}
@test "(nginx-vhosts) nginx:build-config (failed validate_nginx)" {

View File

@@ -430,6 +430,14 @@ upstream {{ $.APP }}-{{ \$upstream_port }} {
server {{ \$listener_ip }}:{{ \$upstream_port }};{{ end }}
}
{{ end }}{{ end }}
{{ if $.DOKKU_APP_WORKER_LISTENERS }}
{{ range \$upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }}
upstream {{ $.APP }}-worker-{{ \$upstream_port }} {
{{ range \$listeners := $.DOKKU_APP_WORKER_LISTENERS | split " " }}
server {{ \$listeners }};{{ end }}
}
{{ end }}{{ end }}
EOF
cat "$APP_REPO_DIR/nginx.conf.sigil"
}