mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-24 12:28:56 +00:00
templated dockerfiles building used by tests
* test images are built without diginc/ namespace * no tests for other archs yet, unsure if they'll even build on travis * Removed old dockerfiles * New files names require Docker Cloud reconfiguration when merged upstream * Probably some stuff I missed, just ask me
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
''' This file starts with 000 to make it run first '''
|
||||
import pytest
|
||||
import testinfra
|
||||
import DockerfileGeneration
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
@pytest.mark.parametrize("upstream,image,tag", [
|
||||
( 'alpine:edge', 'alpine.docker', 'diginc/pi-hole:alpine' ),
|
||||
( 'debian:jessie', 'debian.docker', 'diginc/pi-hole:debian' ),
|
||||
#( 'jsurf/rpi-raspbian', 'debian-armhf.docker', 'diginc/pi-hole:arm' ),
|
||||
|
||||
def test_generate_dockerfiles():
|
||||
DockerfileGeneration.generate_dockerfiles()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("os, archs", [
|
||||
( 'debian' , DockerfileGeneration.images['debian'] ),
|
||||
( 'alpine' , DockerfileGeneration.images['alpine'] ),
|
||||
])
|
||||
def test_build_pihole_image(upstream, image, tag):
|
||||
run_local('docker pull {}'.format(upstream))
|
||||
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
|
||||
def test_build_pihole_image(os, archs):
|
||||
''' Build the entire matrix of OS+Architecture '''
|
||||
for image in archs:
|
||||
dockerfile = 'Dockerfile_{}_{}'.format(os, image['arch'])
|
||||
image_tag = '{}:{}_{}'.format(image['name'], os, image['arch'])
|
||||
|
||||
run_local('docker pull {}'.format(image['base']))
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(dockerfile, image_tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
print build_cmd.stderr
|
||||
assert build_cmd.rc == 0
|
||||
|
||||
Reference in New Issue
Block a user