2016-10-11 04:14:39 +00:00
|
|
|
''' This file starts with 000 to make it run first '''
|
|
|
|
import pytest
|
|
|
|
import testinfra
|
|
|
|
|
|
|
|
run_local = testinfra.get_backend(
|
|
|
|
"local://"
|
|
|
|
).get_module("Command").run
|
|
|
|
|
2018-07-02 20:54:19 +00:00
|
|
|
|
2016-10-11 04:14:39 +00:00
|
|
|
@pytest.mark.parametrize("image,tag", [
|
2018-07-03 06:33:30 +00:00
|
|
|
('test/debian.Dockerfile', 'pytest_pihole:debian'),
|
|
|
|
('test/centos.Dockerfile', 'pytest_pihole:centos'),
|
2018-07-06 00:12:39 +00:00
|
|
|
('test/fedora.Dockerfile', 'pytest_pihole:fedora'),
|
2016-10-11 04:14:39 +00:00
|
|
|
])
|
2020-10-05 18:43:07 +00:00
|
|
|
# mark as 'build_stage' so we can ensure images are built first when tests
|
2018-07-08 00:42:10 +00:00
|
|
|
# are executed in parallel. (not required when tests are executed serially)
|
|
|
|
@pytest.mark.build_stage
|
2016-10-11 04:14:39 +00:00
|
|
|
def test_build_pihole_image(image, tag):
|
|
|
|
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
|
|
|
if build_cmd.rc != 0:
|
2020-03-03 07:30:44 +00:00
|
|
|
print(build_cmd.stdout)
|
|
|
|
print(build_cmd.stderr)
|
2016-10-11 04:14:39 +00:00
|
|
|
assert build_cmd.rc == 0
|