From 135e78c868233fe528c1b40bb5c516568b77b47a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 10 Jul 2021 01:45:37 -0400 Subject: [PATCH] tests: add test for procfile-path --- tests/apps/dockerfile-procfile/Procfile | 1 + tests/apps/dockerfile-procfile/release.js | 3 ++ .../apps/dockerfile-procfile/second.Procfile | 8 ++++ tests/apps/python/second.Procfile | 1 + tests/unit/ps-general.bats | 41 +++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 tests/apps/dockerfile-procfile/release.js create mode 100644 tests/apps/dockerfile-procfile/second.Procfile create mode 100644 tests/apps/python/second.Procfile diff --git a/tests/apps/dockerfile-procfile/Procfile b/tests/apps/dockerfile-procfile/Procfile index 9c49227a7..a0e5c7d45 100644 --- a/tests/apps/dockerfile-procfile/Procfile +++ b/tests/apps/dockerfile-procfile/Procfile @@ -6,3 +6,4 @@ cron: node worker.js web: node web.js worker: node worker.js +release: node release.js diff --git a/tests/apps/dockerfile-procfile/release.js b/tests/apps/dockerfile-procfile/release.js new file mode 100644 index 000000000..0cc2afc3a --- /dev/null +++ b/tests/apps/dockerfile-procfile/release.js @@ -0,0 +1,3 @@ +var secret = process.env.SECRET_KEY || ""; + +console.log('SECRET_KEY: ' + secret); diff --git a/tests/apps/dockerfile-procfile/second.Procfile b/tests/apps/dockerfile-procfile/second.Procfile new file mode 100644 index 000000000..9c49227a7 --- /dev/null +++ b/tests/apps/dockerfile-procfile/second.Procfile @@ -0,0 +1,8 @@ +############################### +# DEVELOPMENT # +############################### + +# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job) +cron: node worker.js +web: node web.js +worker: node worker.js diff --git a/tests/apps/python/second.Procfile b/tests/apps/python/second.Procfile new file mode 100644 index 000000000..b03a168c7 --- /dev/null +++ b/tests/apps/python/second.Procfile @@ -0,0 +1 @@ +web: python3 web.py diff --git a/tests/unit/ps-general.bats b/tests/unit/ps-general.bats index ebe719428..0fed2d3fc 100644 --- a/tests/unit/ps-general.bats +++ b/tests/unit/ps-general.bats @@ -198,3 +198,44 @@ EOF assert_success assert_output_contains "bar" } + + +@test "(ps:set) procfile-path" { + run deploy_app dockerfile-procfile + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku ps:set $TEST_APP procfile-path nonexistent-procfile" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku ps:rebuild $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_failure + assert_output_contains "Could not start due to" + + run /bin/bash -c "dokku ps:set $TEST_APP procfile-path second.Procfile" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku ps:rebuild $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + assert_output_contains 'SECRET_KEY:' 0 + + run /bin/bash -c "dokku ps:set $TEST_APP procfile-path" + echo "output: $output" + echo "status: $status" + assert_success + + run /bin/bash -c "dokku ps:rebuild $TEST_APP" + echo "output: $output" + echo "status: $status" + assert_success + assert_output_contains 'SECRET_KEY:' +}