fix: correctly handle is-deployed check
Previously, checking if an app was deployed actually checked if there were any running processes. This is not only incorrect, but also fails to take into account applications that do not have running processes and are only used for one-off commands. This fix migrates apps to the new "deployed" property which is set in core-post-deploy. The result is a slightly faster "deployed" check that is correct and allows non-scaled apps to actually work. Closes #4398
This commit is contained in:
1
tests/apps/python-console-only/Procfile
Normal file
1
tests/apps/python-console-only/Procfile
Normal file
@@ -0,0 +1 @@
|
||||
console: python3 console.py
|
||||
1
tests/apps/python-console-only/console.py
Normal file
1
tests/apps/python-console-only/console.py
Normal file
@@ -0,0 +1 @@
|
||||
print("Hello world!")
|
||||
0
tests/apps/python-console-only/null
Normal file
0
tests/apps/python-console-only/null
Normal file
@@ -151,3 +151,50 @@ EOF
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(ps:scale) console-only app" {
|
||||
run /bin/bash -c "dokku ps:scale $TEST_APP web=0 console=0"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:report $TEST_APP --deployed"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "false"
|
||||
|
||||
run deploy_app python-console-only
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku ps:report $TEST_APP --deployed"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP console"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Hello world!"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP printenv FOO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku --rm config:set $TEST_APP FOO=bar"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Releasing $TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP printenv FOO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "bar"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user