From 4c23964964d2d6bc86a36a29f7d44721ad3ec2eb Mon Sep 17 00:00:00 2001 From: bcambl Date: Sat, 7 Jul 2018 18:42:10 -0600 Subject: [PATCH] ensure images are build prior to running tests Signed-off-by: bcambl --- .travis.yml | 6 +++++- test/test_000_build_containers.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e8c6ce10..563ec131 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/test/test_000_build_containers.py b/test/test_000_build_containers.py index ad243754..e9e9e7db 100644 --- a/test/test_000_build_containers.py +++ b/test/test_000_build_containers.py @@ -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: