rename/clarify test and move RunningPiHole to global py.test scope

This commit is contained in:
diginc 2016-11-06 13:40:24 -06:00
parent 879f39c52d
commit 6ec264e3b6
3 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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):

View File

@ -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'),