[MOLECULE 3.3.0] Fix verifier tests for several roles 90/120690/3
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>
Tue, 20 Apr 2021 09:53:59 +0000 (11:53 +0200)
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>
Tue, 20 Apr 2021 14:04:04 +0000 (16:04 +0200)
Change-Id: I54f618fbb3d1bfefca329e647f78ba9b93f8a283
Issue-ID: OOM-2722
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
ansible/roles/chrony/molecule/default/tests/test_default.py
ansible/roles/docker/molecule/default/molecule.yml
ansible/roles/docker/molecule/ubuntu/molecule.yml
ansible/roles/nfs/molecule/default/tests/test_nfs-server.py
ansible/roles/package-repository/molecule/default/tests/test_infrastructure-server.py
ansible/roles/package-repository/molecule/default/tests/test_kubernetes-node-1.py
ansible/roles/resource-data/molecule/default/group_vars/all.yml
ansible/roles/resource-data/molecule/default/tests/test_default.py
ansible/test/images/docker/ubuntu/Dockerfile

index 08f85d3..c0380f5 100644 (file)
@@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
 @pytest.fixture
 def chrony_conf_file(host, os_family):
-    conf = host.ansible('include_vars', 'file=../../defaults/main.yml')[
+    conf = host.ansible('include_vars', 'file=defaults/main.yml')[
             'ansible_facts']['chrony']['conf'][os_family]['config_file']
     return conf
 
index 10ce1f4..adc7c54 100644 (file)
@@ -34,5 +34,3 @@ verifier:
   name: testinfra
   options:
     verbose: true
-    options:
-      ignore: W291  # trailing whitespace
index 5abaef5..eb90784 100644 (file)
@@ -38,6 +38,4 @@ verifier:
   name: testinfra
   options:
     verbose: true
-    options:
-      ignore: W291  # trailing whitespace
   directory: ../default/tests/
index e35e21c..41d3090 100644 (file)
@@ -29,5 +29,5 @@ def test_exports(host):
         "eth0").addresses[0]
     f = host.file(host_file)
     assert f.exists
-    assert f.content_string == \
+    assert f.content_string.strip() == \
         """/dockerdata-nfs  """ + node2_ip + """(rw,sync,no_root_squash,no_subtree_check)"""  # noqa: E501
index 5b3fce4..02639b6 100644 (file)
@@ -9,7 +9,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 def test_onap_repo(host):
     os = host.system_info.distribution
     if os == "centos":
-        fc = host.file('/etc/yum.repos.d/moleculetestapp.repo').content_string
+        fc = host.file('/etc/yum.repos.d/moleculetestapp.repo'
+                       ).content_string.strip()
         expected_content = """[moleculetestapp]
 baseurl = file:///opt/moleculetestapp/pkg/rpm
 enabled = 1
@@ -18,6 +19,6 @@ name = MOLECULETESTAPP offline repository"""
         assert fc == expected_content
     elif os == "ubuntu":
         fc = host.file('/etc/apt/sources.list.d/moleculetestapp.list')
-        fc = fc.content_string
+        fc = fc.content_string.strip()
         ec = "deb [trusted=yes] file:///opt/moleculetestapp/pkg/deb ./"
         assert fc == ec
index c1831f7..06efdfc 100644 (file)
@@ -9,7 +9,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 def test_onap_repo(host):
     os = host.system_info.distribution
     if os == "centos":
-        fc = host.file('/etc/yum.repos.d/moleculetestapp.repo').content_string
+        fc = host.file('/etc/yum.repos.d/moleculetestapp.repo'
+                       ).content_string.strip()
         expected_content = """[moleculetestapp]
 baseurl = http://repo.infra-server/rpm
 enabled = 1
@@ -18,6 +19,6 @@ name = MOLECULETESTAPP offline repository"""
         assert fc == expected_content
     elif os == "ubuntu":
         fc = host.file('/etc/apt/sources.list.d/moleculetestapp.list')
-        fc = fc.content_string
+        fc = fc.content_string.strip()
         ec = "deb [trusted=yes] http://repo.infra-server/deb ./"
         assert fc == ec
index 46ab3e0..0a7abb3 100644 (file)
@@ -1,6 +1,6 @@
 ---
 app_data_path: /opt/moleculeapp
-aux_data_path: "{{ app_data_path }}/runtime_images_source_dir"
+aux_data_path: "/opt/moleculeapp/runtime_images_source_dir"
 resources_dir: /data
 resources_filename: resources_package.tar
 aux_resources_filename: aux_resources_package.tar
index 7cff76a..c96685a 100644 (file)
@@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
 @pytest.fixture
 def group_vars(host):
-    all_file = "file=group_vars/all.yml name=all"
+    all_file = "file=molecule/default/group_vars/all.yml name=all"
     return host.ansible("include_vars", all_file)["ansible_facts"]["all"]
 
 
index 6dd079a..be9e19c 100644 (file)
@@ -5,7 +5,7 @@ FROM ubuntu:${RELEASE}
 ENV container docker
 
 # Install necessary packages
-RUN apt-get update && apt-get -y install dbus systemd openssh-server iproute2 python3-docker
+RUN apt-get update && apt-get -y install dbus systemd openssh-server iproute2 python3-docker python3-apt
 
 # Create symlink python3 -> python
 RUN ln -s /usr/bin/python3 /usr/bin/python