From 8886784b2e9fd5577267bd15e8ca4f8fb480532a Mon Sep 17 00:00:00 2001 From: diginc Date: Wed, 18 Oct 2017 22:24:22 -0500 Subject: [PATCH] fix webserver and image --- .travis.yml | 2 +- test/conftest.py | 23 +++++++++++++++-------- tox.ini | 6 ++++-- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index faeb787..a2511d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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/ diff --git a/test/conftest.py b/test/conftest.py index c7607e9..d103017 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -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): diff --git a/tox.ini b/tox.ini index 9b75225..aec61dd 100644 --- a/tox.ini +++ b/tox.ini @@ -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/