@@ -22,9 +22,8 @@ def test_exit_when_no_status_page_is_configured(host, setup_fpm_to_default_fixtu
22
22
23
23
cmd = host .run ("php-fpm-healthcheck -v" )
24
24
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
28
27
29
28
@pytest .mark .php_fpm
30
29
def 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):
34
33
35
34
cmd = host .run ("FCGI_CONNECT=/var/run/php-fpm.sock php-fpm-healthcheck -v" )
36
35
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
39
38
assert "pool:" in cmd .stdout
40
39
41
40
# https://github.com/renatomefi/php-fpm-healthcheck/issues/18
42
41
@pytest .mark .php_fpm
43
42
def test_fpm_on_socket_with_huge_env (host , setup_fpm_to_default_fixture ):
44
43
cmd = host .run ("HUGE_ENV=\" $(dd if=/dev/zero bs=8192 count=1 | tr '\\ 000' '\\ 040')\" php-fpm-healthcheck -v" )
45
44
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
48
47
assert "pool:" in cmd .stdout
49
48
50
49
@pytest .mark .php_fpm
51
50
def test_default_status_page_path (host , setup_fpm_to_default_fixture ):
52
51
cmd = host .run ("php-fpm-healthcheck -v" )
53
52
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
55
54
56
55
@pytest .mark .php_fpm
57
56
def test_exit_when_fpm_is_invalid_path (host , setup_fpm_to_default_fixture ):
58
57
cmd = host .run ("FCGI_STATUS_PATH=/invalid php-fpm-healthcheck -v" )
59
58
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
63
83
64
84
@pytest .mark .alpine
65
85
def test_exit_when_fpm_is_not_reachable_apk (host , setup_fpm_to_default_fixture ):
66
86
cmd = host .run ("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v" )
67
87
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
69
89
70
90
@pytest .mark .alpine
71
91
def test_exit_when_fpm_is_invalid_host_apk (host , setup_fpm_to_default_fixture ):
72
92
cmd = host .run ("FCGI_CONNECT=abc php-fpm-healthcheck -v" )
73
93
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
75
95
76
96
@pytest .mark .stretch
77
97
def test_exit_when_fpm_is_not_reachable_apt (host , setup_fpm_to_default_fixture ):
78
98
cmd = host .run ("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v" )
79
99
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
81
101
82
102
@pytest .mark .stretch
83
103
def test_exit_when_fpm_is_invalid_host_apt (host , setup_fpm_to_default_fixture ):
84
104
cmd = host .run ("FCGI_CONNECT=abc php-fpm-healthcheck -v" )
85
105
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
87
107
0 commit comments