diff --git a/_tests/Makefile b/_tests/Makefile --- a/_tests/Makefile +++ b/_tests/Makefile @@ -1,3 +1,3 @@ test: python -m unittest discover modules - + python -m unittest discover pillar diff --git a/_tests/pillar/__init__.py b/_tests/pillar/__init__.py new file mode 100644 diff --git a/_tests/pillar/paas/__init__.py b/_tests/pillar/paas/__init__.py new file mode 100644 diff --git a/_tests/pillar/paas/test_docker.py b/_tests/pillar/paas/test_docker.py new file mode 100644 --- /dev/null +++ b/_tests/pillar/paas/test_docker.py @@ -0,0 +1,25 @@ +import unittest +import yaml + + +PILLAR_FILE = '../pillar/paas/docker.sls' + + +class Testinstance(unittest.TestCase): + + def setUp(self): + with open(PILLAR_FILE, 'r') as fd: + self.pillar = yaml.load(fd) + + # nginx needs a host/app_port pair to spawn a configuration + def test_host_is_paired_with_app_port_option(self): + for node, services in self.pillar['docker_containers'].items(): + for service, containers in services.items(): + for instance, container in containers.items(): + if 'host' not in container: + continue + + entry = ':'.join(['docker_containers', node, + service, instance]) + self.assertIn('app_port', container, + entry + ": app_port missing") diff --git a/pillar/paas/docker.sls b/pillar/paas/docker.sls --- a/pillar/paas/docker.sls +++ b/pillar/paas/docker.sls @@ -348,7 +348,7 @@ # declared above. exim: sentry_smtp: - host: mx.sentry.nasqueron.org + mailname: mx.sentry.nasqueron.org sentry: sentry_web_1: diff --git a/roles/paas-docker/containers/exim.sls b/roles/paas-docker/containers/exim.sls --- a/roles/paas-docker/containers/exim.sls +++ b/roles/paas-docker/containers/exim.sls @@ -28,7 +28,7 @@ /srv/exim/{{ instance }}/mailname: file.managed: - - contents: {{ container['host'] }} + - contents: {{ container['mailname'] }} {% if has_selinux %} @@ -57,7 +57,7 @@ {% if 'host' in container %} - binds: /srv/exim/{{ instance }}/mailname:/etc/mailname:ro - - hostname: container['host'] + - hostname: container['mailname'] {% endif %} {% if 'network' in container %}