-
Notifications
You must be signed in to change notification settings - Fork 53
/
test_execution.py
43 lines (35 loc) · 1.4 KB
/
test_execution.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pytest
@pytest.mark.php_fpm
def test_invalid_option_exits_properly(host):
cmd = host.run("php-fpm-healthcheck --invalid-option")
assert cmd.rc == 3
cmd = host.run("php-fpm-healthcheck --invalid-option=")
assert cmd.rc == 3
@pytest.mark.php_fpm
def test_valid_with_empty_value_exits_properly(host):
cmd = host.run("php-fpm-healthcheck --listen-queue-len=")
assert cmd.rc == 3
assert "option value must be an integer" in cmd.stderr
@pytest.mark.php_fpm
def test_valid_with_non_integer_value_exits_properly(host):
cmd = host.run("php-fpm-healthcheck --listen-queue-len=abc")
assert cmd.rc == 3
assert "option value must be an integer" in cmd.stderr
@pytest.mark.alpine
def test_missing_fcgi_apk(host):
host.run("apk del fcgi")
cmd = host.run("php-fpm-healthcheck")
assert cmd.rc == 4
assert "Make sure fcgi is installed" in cmd.stderr
# Fail safe for other tests, maybe we could use a docker fixture
# to start a new container everytime
host.run("apk add --no-cache fcgi")
@pytest.mark.stretch
def test_missing_fcgi_apt(host):
host.run("apt-get remove -y libfcgi-bin")
cmd = host.run("php-fpm-healthcheck")
assert cmd.rc == 4
assert "Make sure fcgi is installed" in cmd.stderr
# Fail safe for other tests, maybe we could use a docker fixture
# to start a new container everytime
host.run("apt-get install -y libfcgi-bin")