summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Savineau <dsavinea@redhat.com>2019-02-08 16:44:23 -0500
committerDimitri Savineau <dsavinea@redhat.com>2019-02-08 16:44:23 -0500
commit1b1db5eb3cafbf92b43864b5cd95e76d06e5c9ae (patch)
tree250f1fc6df7898688067c20254f875cb11780480
parente9bf77f0c507d763e8850c72e6436eba02dd832d (diff)
molecule: Add tests
We test both SSL certificate files (cert and key) generated. Change-Id: Ie0b186d98d95d5776b2e4531fb00d40eccc098dc
-rw-r--r--molecule/default/tests/test_default.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py
new file mode 100644
index 0000000..6a6be08
--- /dev/null
+++ b/molecule/default/tests/test_default.py
@@ -0,0 +1,29 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_ssl_cert_file(host):
+ f = host.file('/etc/ssl/repo/dci.crt')
+ assert f.exists
+ assert f.is_file
+ assert f.user == 'root'
+ assert f.group == 'root'
+ assert f.mode == 0o644
+ assert f.contains('-----BEGIN CERTIFICATE-----')
+ assert f.contains('-----END CERTIFICATE-----')
+
+
+def test_ssl_key_file(host):
+ with host.sudo():
+ f = host.file('/etc/ssl/repo/dci.key')
+ assert f.exists
+ assert f.is_file
+ assert f.user == 'root'
+ assert f.group == 'root'
+ assert f.mode == 0o600
+ assert f.contains('-----BEGIN PRIVATE KEY-----')
+ assert f.contains('-----END PRIVATE KEY-----')