fix webserver and image

This commit is contained in:
diginc 2017-10-18 22:24:22 -05:00
parent dded3945f5
commit 8886784b2e
3 changed files with 20 additions and 11 deletions

View File

@ -23,4 +23,4 @@ script:
- ./Dockerfile.py --os=${OS} --arch=${ARCH} -v
- docker images
# run docker build & tests
- py.test -vv -k "${OS}-${ARCH}" test/
- py.test -vv -n auto -k "${OS}-${ARCH}" ./test/

View File

@ -1,8 +1,6 @@
import pytest
import testinfra
WEB_SERVER = { 'alpine_amd64': 'nginx', 'debian_amd64': 'lighttpd' }
check_output = testinfra.get_backend(
"local://"
).get_module("Command").check_output
@ -70,13 +68,16 @@ def tag(request, os, arch):
@pytest.fixture
def webserver(request, tag):
return WEB_SERVER[tag]
webserver = 'nginx'
if 'debian' in tag:
webserver = 'lighttpd'
return webserver
@pytest.fixture()
def image(request, tag):
image = 'pi-hole'
if 'amd64' not in tag:
image = 'pi-hole-multiarch'
image = 'pi-hole-multiarch'
if 'amd64' in tag:
image = 'pi-hole'
return '{}:{}'.format(image, tag)
@pytest.fixture()
@ -101,11 +102,17 @@ def persist_tag(request, persist_os, persist_arch):
@pytest.fixture(scope='module')
def persist_webserver(request, persist_tag):
return WEB_SERVER[persist_tag]
webserver = 'nginx'
if 'debian' in persist_tag:
webserver = 'lighttpd'
return webserver
@pytest.fixture(scope='module')
def persist_image(request, persist_tag):
return 'pi-hole:{}'.format(persist_tag)
image = 'pi-hole-multiarch'
if 'amd64' in persist_tag:
image = 'pi-hole'
return '{}:{}'.format(image, persist_tag)
@pytest.fixture(scope='module')
def persist_cmd(request):

View File

@ -2,6 +2,8 @@
envlist = py27
[testenv]
whitelist_externals = docker
deps = -rrequirements.txt
commands = python Dockerfile.py
pytest {posargs:-vv -n auto} ./test
commands = docker run --rm --privileged multiarch/qemu-user-static:register --reset
./Dockerfile.py
pytest {posargs:-vv -n auto} ./test/