pi-hole/test/test_000_build_containers.py
Adam Warner 2a82e1fec1
Nothing to see here. I just forgot a page.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-11-18 23:29:08 +00:00

29 lines
1.1 KiB
Python

''' This file starts with 000 to make it run first '''
import pytest
import testinfra
run_local = testinfra.get_backend(
"local://"
).get_module("Command").run
@pytest.mark.parametrize("image,tag", [
('test/debian_9.Dockerfile', 'pytest_pihole:debian_9'),
('test/debian_10.Dockerfile', 'pytest_pihole:debian_10'),
('test/centos_7.Dockerfile', 'pytest_pihole:centos_7'),
('test/centos_8.Dockerfile', 'pytest_pihole:centos_8'),
('test/fedora_31.Dockerfile', 'pytest_pihole:fedora_31'),
('test/fedora_32.Dockerfile', 'pytest_pihole:fedora_32'),
('test/ubuntu_16.Dockerfile', 'pytest_pihole:ubuntu_16'),
('test/ubuntu_18.Dockerfile', 'pytest_pihole:ubuntu_18'),
('test/ubuntu_20.Dockerfile', 'pytest_pihole:ubuntu_20'),
])
# mark as 'build_stage' so we can ensure images are built 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:
print(build_cmd.stdout)
print(build_cmd.stderr)
assert build_cmd.rc == 0