Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11700503
D3660.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3660.diff
View Options
diff --git a/_tests/pillar/paas/test_docker.py b/_tests/pillar/paas/test_docker.py
--- a/_tests/pillar/paas/test_docker.py
+++ b/_tests/pillar/paas/test_docker.py
@@ -1,27 +1,44 @@
#!/usr/bin/env python3
+from unittest_data_provider import data_provider
+import os
import unittest
import yaml
-PILLAR_FILE = "../pillar/paas/docker.sls"
+PILLAR_PATH = "../pillar/paas/docker/"
class Testinstance(unittest.TestCase):
- def setUp(self):
- with open(PILLAR_FILE, "r") as fd:
- self.pillar = yaml.safe_load(fd)
+ def pillar_files():
+ sls_files = find_sls_files(PILLAR_PATH)
+
+ return tuple((file,) for file in sls_files)
# 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")
+ @data_provider(pillar_files)
+ def test_host_is_paired_with_app_port_option(self, pillar_file):
+ with open(pillar_file, "r") as fd:
+ self.pillar = yaml.safe_load(fd)
+
+ for service, containers in self.pillar["docker_containers"].items():
+ for instance, container in containers.items():
+ if "host" not in container:
+ continue
+
+ entry = ":".join(["docker_containers", pillar_file, service, instance])
+ self.assertIn("app_port", container, entry + ": app_port missing")
+
+
+def find_sls_files(path):
+ sls_files = []
+
+ for root, _, files in os.walk(path):
+ for filename in files:
+ if filename.endswith(".sls"):
+ sls_files.append(os.path.join(root, filename))
+
+ return sls_files
if __name__ == "__main__":
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 13, 14:15 (14 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2981000
Default Alt Text
D3660.diff (2 KB)
Attached To
Mode
D3660: Fix docker_containers app_port/host test
Attached
Detach File
Event Timeline
Log In to Comment