summaryrefslogtreecommitdiffstats
path: root/ansible/roles/nfs/molecule/default
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/nfs/molecule/default')
-rw-r--r--ansible/roles/nfs/molecule/default/molecule.yml2
-rw-r--r--ansible/roles/nfs/molecule/default/tests/test_default.py15
-rw-r--r--ansible/roles/nfs/molecule/default/tests/test_nfs-server.py7
3 files changed, 17 insertions, 7 deletions
diff --git a/ansible/roles/nfs/molecule/default/molecule.yml b/ansible/roles/nfs/molecule/default/molecule.yml
index a8ca6a30..9af32360 100644
--- a/ansible/roles/nfs/molecule/default/molecule.yml
+++ b/ansible/roles/nfs/molecule/default/molecule.yml
@@ -43,6 +43,8 @@ provisioner:
host_vars: host_vars
lint:
name: ansible-lint
+scenario:
+ name: default
verifier:
name: testinfra
lint:
diff --git a/ansible/roles/nfs/molecule/default/tests/test_default.py b/ansible/roles/nfs/molecule/default/tests/test_default.py
index 48139898..dc808753 100644
--- a/ansible/roles/nfs/molecule/default/tests/test_default.py
+++ b/ansible/roles/nfs/molecule/default/tests/test_default.py
@@ -7,10 +7,13 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-@pytest.mark.parametrize('pkg', [
- 'nfs-utils'
+@pytest.mark.parametrize('distro,pkg', [
+ ('centos', 'nfs-utils'),
+ ('ubuntu', 'nfs-common'),
+ ('ubuntu', 'nfs-kernel-server')
])
-def test_pkg(host, pkg):
- package = host.package(pkg)
-
- assert package.is_installed
+def test_pkg(host, distro, pkg):
+ os = host.system_info.distribution
+ if distro == os:
+ package = host.package(pkg)
+ assert package.is_installed
diff --git a/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py b/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py
index 88ba0a61..e35e21c3 100644
--- a/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py
+++ b/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py
@@ -20,9 +20,14 @@ def test_svc(host, svc):
def test_exports(host):
+ os = host.system_info.distribution
+ if (os == "centos"):
+ host_file = "/etc/exports.d/dockerdata-nfs.exports"
+ elif (os == "ubuntu"):
+ host_file = "/etc/exports"
node2_ip = testinfra.get_host("docker://kubernetes-node-2").interface(
"eth0").addresses[0]
- f = host.file("/etc/exports.d/dockerdata-nfs.exports")
+ f = host.file(host_file)
assert f.exists
assert f.content_string == \
"""/dockerdata-nfs """ + node2_ip + """(rw,sync,no_root_squash,no_subtree_check)""" # noqa: E501