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 - ./Dockerfile.py --os=${OS} --arch=${ARCH} -v
- docker images - docker images
# run docker build & tests # 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 pytest
import testinfra import testinfra
WEB_SERVER = { 'alpine_amd64': 'nginx', 'debian_amd64': 'lighttpd' }
check_output = testinfra.get_backend( check_output = testinfra.get_backend(
"local://" "local://"
).get_module("Command").check_output ).get_module("Command").check_output
@ -70,13 +68,16 @@ def tag(request, os, arch):
@pytest.fixture @pytest.fixture
def webserver(request, tag): def webserver(request, tag):
return WEB_SERVER[tag] webserver = 'nginx'
if 'debian' in tag:
webserver = 'lighttpd'
return webserver
@pytest.fixture() @pytest.fixture()
def image(request, tag): def image(request, tag):
image = 'pi-hole' image = 'pi-hole-multiarch'
if 'amd64' not in tag: if 'amd64' in tag:
image = 'pi-hole-multiarch' image = 'pi-hole'
return '{}:{}'.format(image, tag) return '{}:{}'.format(image, tag)
@pytest.fixture() @pytest.fixture()
@ -101,11 +102,17 @@ def persist_tag(request, persist_os, persist_arch):
@pytest.fixture(scope='module') @pytest.fixture(scope='module')
def persist_webserver(request, persist_tag): 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') @pytest.fixture(scope='module')
def persist_image(request, persist_tag): 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') @pytest.fixture(scope='module')
def persist_cmd(request): def persist_cmd(request):

View File

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