Skip to content

Commit 168fc0a

Browse files
author
Gabriel Fernandes
committed
Add fpm error code test
1 parent ca8e59a commit 168fc0a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/testinfra/test_fpm.py

+10
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ def test_exit_when_fpm_is_invalid_path(host, setup_fpm_to_default_fixture):
5959
assert "Trying to connect to PHP-FPM via: localhost:9000/invalid" in cmd.stdout
6060
assert "Unable to reach PHP-FPM status page. Response code: 404" in cmd.stderr
6161

62+
@pytest.mark.php_fpm
63+
def test_exit_when_fpm_has_error_code(host, setup_fpm_to_default_fixture):
64+
host.run("mkdir -p /var/www/html/error")
65+
host.run("touch /var/www/html/error/index.php")
66+
host.run("echo \"<?php http_response_code(500);\" > /var/www/html/error/index.php")
67+
cmd = host.run("FCGI_STATUS_PATH=/var/www/html/error/index.php php-fpm-healthcheck -v")
68+
assert cmd.rc == 8
69+
assert "Trying to connect to PHP-FPM via: localhost:9000/var/www/html/error/index.php" in cmd.stdout
70+
assert "Unable to reach PHP-FPM status page. Response code: 500" in cmd.stderr
71+
6272
@pytest.mark.alpine
6373
def test_exit_when_fpm_is_not_reachable_apk(host, setup_fpm_to_default_fixture):
6474
cmd = host.run("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v")

0 commit comments

Comments
 (0)