rename/clarify test and move RunningPiHole to global py.test scope
This commit is contained in:
parent
879f39c52d
commit
6ec264e3b6
|
@ -107,3 +107,13 @@ def Dig(request):
|
||||||
return dig_container
|
return dig_container
|
||||||
return dig
|
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
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ expected_debian_lines = [
|
||||||
('debian', expected_debian_lines, 1),
|
('debian', expected_debian_lines, 1),
|
||||||
('debian', expected_debian_lines, 2)
|
('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 '''
|
''' confirm all expected output is there and nothing else '''
|
||||||
stdout = ''
|
stdout = ''
|
||||||
for i in range(repeat_function):
|
for i in range(repeat_function):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import time
|
||||||
docker containers (esp. alpine) stripped down nature '''
|
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'
|
expected_proc = '/sbin/tini -- /start.sh'
|
||||||
pgrep = 'pgrep -f "{}" | wc -l || echo 0'.format(expected_proc)
|
pgrep = 'pgrep -f "{}" | wc -l || echo 0'.format(expected_proc)
|
||||||
find_proc = Docker.run(pgrep).stdout
|
find_proc = Docker.run(pgrep).stdout
|
||||||
|
@ -24,16 +24,6 @@ def test_ServerIP_missing_triggers_start_error(Docker):
|
||||||
assert error_msg in start.stdout
|
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', [
|
@pytest.mark.parametrize('hostname,expected_ip', [
|
||||||
('pi.hole', '192.168.100.2'),
|
('pi.hole', '192.168.100.2'),
|
||||||
('google-public-dns-a.google.com', '8.8.8.8'),
|
('google-public-dns-a.google.com', '8.8.8.8'),
|
||||||
|
|
Loading…
Reference in New Issue