diff --git a/test/conftest.py b/test/conftest.py index aaf6a22..197b561 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -107,3 +107,13 @@ def Dig(request): return dig_container return dig +''' +Persistent Docker container for testing service post start.sh +''' +@pytest.fixture +def RunningPiHole(DockerPersist, Slow, persist_webserver): + ''' Persist a fully started docker-pi-hole to help speed up subsequent tests ''' + Slow(lambda: DockerPersist.run('pgrep {}'.format(persist_webserver) ).rc == 0) + Slow(lambda: DockerPersist.run('pgrep dnsmasq').rc == 0) + return DockerPersist + diff --git a/test/test_bash_functions.py b/test/test_bash_functions.py index 0482dee..07c98ac 100644 --- a/test/test_bash_functions.py +++ b/test/test_bash_functions.py @@ -47,7 +47,7 @@ expected_debian_lines = [ ('debian', expected_debian_lines, 1), ('debian', expected_debian_lines, 2) ]) -def test_setup_php_env(Docker, tag, expected_lines, repeat_function): +def test_debian_setup_php_env(Docker, tag, expected_lines, repeat_function): ''' confirm all expected output is there and nothing else ''' stdout = '' for i in range(repeat_function): diff --git a/test/test_start.py b/test/test_start.py index c71d789..55dbe69 100644 --- a/test/test_start.py +++ b/test/test_start.py @@ -5,7 +5,7 @@ import time docker containers (esp. alpine) stripped down nature ''' -def test_pihole_default_run_command(Docker): +def test_pihole_default_run_command(Docker, tag): expected_proc = '/sbin/tini -- /start.sh' pgrep = 'pgrep -f "{}" | wc -l || echo 0'.format(expected_proc) find_proc = Docker.run(pgrep).stdout @@ -24,16 +24,6 @@ def test_ServerIP_missing_triggers_start_error(Docker): assert error_msg in start.stdout -''' -Persistent Docker container for testing service post start.sh -''' -@pytest.fixture -def RunningPiHole(DockerPersist, Slow, persist_webserver): - ''' Persist a fully started docker-pi-hole to help speed up subsequent tests ''' - Slow(lambda: DockerPersist.run('pgrep {}'.format(persist_webserver) ).rc == 0) - Slow(lambda: DockerPersist.run('pgrep dnsmasq').rc == 0) - return DockerPersist - @pytest.mark.parametrize('hostname,expected_ip', [ ('pi.hole', '192.168.100.2'), ('google-public-dns-a.google.com', '8.8.8.8'),