@@ -22,9 +22,8 @@ def test_exit_when_no_status_page_is_configured(host, setup_fpm_to_default_fixtu
2222
2323 cmd = host .run ("php-fpm-healthcheck -v" )
2424 assert cmd .rc == 8
25- assert "Trying to connect to php-fpm via:" in cmd .stdout
26- assert "status output:" in cmd .stdout
27- assert "php-fpm status page non reachable" in cmd .stderr
25+ assert "Trying to connect to PHP-FPM via:" in cmd .stdout
26+ assert "PHP-FPM status page non reachable. Error: 404" in cmd .stderr
2827
2928@pytest .mark .php_fpm
3029def test_fpm_on_socket (host , setup_fpm_to_default_fixture ):
@@ -34,54 +33,75 @@ def test_fpm_on_socket(host, setup_fpm_to_default_fixture):
3433
3534 cmd = host .run ("FCGI_CONNECT=/var/run/php-fpm.sock php-fpm-healthcheck -v" )
3635 assert cmd .rc == 0
37- assert "Trying to connect to php-fpm via:" in cmd .stdout
38- assert "status output:" in cmd .stdout
36+ assert "Trying to connect to PHP-FPM via:" in cmd .stdout
37+ assert "PHP-FPM status output:" in cmd .stdout
3938 assert "pool:" in cmd .stdout
4039
4140# https://github.com/renatomefi/php-fpm-healthcheck/issues/18
4241@pytest .mark .php_fpm
4342def test_fpm_on_socket_with_huge_env (host , setup_fpm_to_default_fixture ):
4443 cmd = host .run ("HUGE_ENV=\" $(dd if=/dev/zero bs=8192 count=1 | tr '\\ 000' '\\ 040')\" php-fpm-healthcheck -v" )
4544 assert cmd .rc == 0
46- assert "Trying to connect to php-fpm via:" in cmd .stdout
47- assert "status output:" in cmd .stdout
45+ assert "Trying to connect to PHP-FPM via:" in cmd .stdout
46+ assert "PHP-FPM status output:" in cmd .stdout
4847 assert "pool:" in cmd .stdout
4948
5049@pytest .mark .php_fpm
5150def test_default_status_page_path (host , setup_fpm_to_default_fixture ):
5251 cmd = host .run ("php-fpm-healthcheck -v" )
5352 assert cmd .rc == 0
54- assert "Trying to connect to php-fpm via: localhost:9000/status" in cmd .stdout
53+ assert "Trying to connect to PHP-FPM via: localhost:9000/status" in cmd .stdout
5554
5655@pytest .mark .php_fpm
5756def test_exit_when_fpm_is_invalid_path (host , setup_fpm_to_default_fixture ):
5857 cmd = host .run ("FCGI_STATUS_PATH=/invalid php-fpm-healthcheck -v" )
5958 assert cmd .rc == 8
60- assert "Trying to connect to php-fpm via: localhost:9000/invalid" in cmd .stdout
61- assert "File not found." in cmd .stdout
62- assert "php-fpm status page non reachable" in cmd .stderr
59+ assert "Trying to connect to PHP-FPM via: localhost:9000/invalid" in cmd .stdout
60+ assert "PHP-FPM status page non reachable. Error: 404" in cmd .stderr
61+
62+ # @pytest.mark.php_fpm
63+ # def test_exit_when_fpm_has_500_error_code(host, setup_fpm_to_default_fixture):
64+ # This tests should be included when possible to use custom status page
65+ # host.run("mkdir -p /var/www/html/error")
66+ # host.run("touch /var/www/html/error/index.php")
67+ # host.run("echo \"<?php http_response_code(500);\" > /var/www/html/error/index.php")
68+ # cmd = host.run("FCGI_STATUS_PATH=/var/www/html/error/index.php php-fpm-healthcheck -v")
69+ # assert cmd.rc == 8
70+ # assert "Trying to connect to PHP-FPM via: localhost:9000/var/www/html/error/index.php" in cmd.stdout
71+ # assert "PHP-FPM status page non reachable. Error: 500" in cmd.stderr
72+
73+ # @pytest.mark.php_fpm
74+ # def test_exit_when_fpm_has_400_error_code(host, setup_fpm_to_default_fixture):
75+ # This tests should be included when possible to use custom status page
76+ # host.run("mkdir -p /var/www/html/error")
77+ # host.run("touch /var/www/html/error/index.php")
78+ # host.run("echo \"<?php http_response_code(400);\" > /var/www/html/error/index.php")
79+ # cmd = host.run("FCGI_STATUS_PATH=/var/www/html/error/index.php php-fpm-healthcheck -v")
80+ # assert cmd.rc == 8
81+ # assert "Trying to connect to PHP-FPM via: localhost:9000/var/www/html/error/index.php" in cmd.stdout
82+ # assert "PHP-FPM status page non reachable. Error: 400" in cmd.stderr
6383
6484@pytest .mark .alpine
6585def test_exit_when_fpm_is_not_reachable_apk (host , setup_fpm_to_default_fixture ):
6686 cmd = host .run ("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v" )
6787 assert cmd .rc in (111 , 9 )
68- assert "Trying to connect to php-fpm via: localhost:9001" in cmd .stdout
88+ assert "Trying to connect to PHP-FPM via: localhost:9001" in cmd .stdout
6989
7090@pytest .mark .alpine
7191def test_exit_when_fpm_is_invalid_host_apk (host , setup_fpm_to_default_fixture ):
7292 cmd = host .run ("FCGI_CONNECT=abc php-fpm-healthcheck -v" )
7393 assert cmd .rc in (2 , 9 )
74- assert "Trying to connect to php-fpm via: abc" in cmd .stdout
94+ assert "Trying to connect to PHP-FPM via: abc" in cmd .stdout
7595
7696@pytest .mark .stretch
7797def test_exit_when_fpm_is_not_reachable_apt (host , setup_fpm_to_default_fixture ):
7898 cmd = host .run ("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v" )
7999 assert cmd .rc == 111
80- assert "Trying to connect to php-fpm via: localhost:9001" in cmd .stdout
100+ assert "Trying to connect to PHP-FPM via: localhost:9001" in cmd .stdout
81101
82102@pytest .mark .stretch
83103def test_exit_when_fpm_is_invalid_host_apt (host , setup_fpm_to_default_fixture ):
84104 cmd = host .run ("FCGI_CONNECT=abc php-fpm-healthcheck -v" )
85105 assert cmd .rc == 2
86- assert "Trying to connect to php-fpm via: abc" in cmd .stdout
106+ assert "Trying to connect to PHP-FPM via: abc" in cmd .stdout
87107
0 commit comments