ensure images are build prior to running tests

Signed-off-by: bcambl <blayne@blaynecampbell.com>
This commit is contained in:
bcambl 2018-07-07 18:42:10 -06:00
parent e4a6dcd35c
commit 4c23964964
2 changed files with 8 additions and 1 deletions

View File

@ -7,4 +7,8 @@ python:
install:
- pip install -r requirements.txt
script: py.test -vv -n auto
script:
# run tasks marked as 'build_stage' first (ensure docker images are built)
- py.test -vv -n auto -m "build_stage"
# run the remaining tasks in the test suite
- py.test -vv -n auto -m "not build_stage"

View File

@ -12,6 +12,9 @@ run_local = testinfra.get_backend(
('test/centos.Dockerfile', 'pytest_pihole:centos'),
('test/fedora.Dockerfile', 'pytest_pihole:fedora'),
])
# mark as 'build_stage' so we can ensure images are build first when tests
# are executed in parallel. (not required when tests are executed serially)
@pytest.mark.build_stage
def test_build_pihole_image(image, tag):
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
if build_cmd.rc != 0: