Skip to content

Commit

Permalink
Add fpm error code test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Fernandes committed Jul 29, 2020
1 parent ca8e59a commit 168fc0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/testinfra/test_fpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def test_exit_when_fpm_is_invalid_path(host, setup_fpm_to_default_fixture):
assert "Trying to connect to PHP-FPM via: localhost:9000/invalid" in cmd.stdout
assert "Unable to reach PHP-FPM status page. Response code: 404" in cmd.stderr

@pytest.mark.php_fpm
def test_exit_when_fpm_has_error_code(host, setup_fpm_to_default_fixture):
host.run("mkdir -p /var/www/html/error")
host.run("touch /var/www/html/error/index.php")
host.run("echo \"<?php http_response_code(500);\" > /var/www/html/error/index.php")
cmd = host.run("FCGI_STATUS_PATH=/var/www/html/error/index.php php-fpm-healthcheck -v")
assert cmd.rc == 8
assert "Trying to connect to PHP-FPM via: localhost:9000/var/www/html/error/index.php" in cmd.stdout
assert "Unable to reach PHP-FPM status page. Response code: 500" in cmd.stderr

@pytest.mark.alpine
def test_exit_when_fpm_is_not_reachable_apk(host, setup_fpm_to_default_fixture):
cmd = host.run("FCGI_CONNECT=localhost:9001 php-fpm-healthcheck -v")
Expand Down

0 comments on commit 168fc0a

Please sign in to comment.