diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-04-20 11:53:59 +0200 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-04-20 16:04:04 +0200 |
commit | 83dd5ae87cd770ef72079db519781be6a01e7e85 (patch) | |
tree | 362ac07956bf55bdf20f81ee184836ce60b1158e /ansible/roles | |
parent | 91cb0cb6886ff6773e6ab2359aa3abd10406f7f2 (diff) |
[MOLECULE 3.3.0] Fix verifier tests for several roles
Change-Id: I54f618fbb3d1bfefca329e647f78ba9b93f8a283
Issue-ID: OOM-2722
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'ansible/roles')
8 files changed, 10 insertions, 12 deletions
diff --git a/ansible/roles/chrony/molecule/default/tests/test_default.py b/ansible/roles/chrony/molecule/default/tests/test_default.py index 08f85d37..c0380f56 100644 --- a/ansible/roles/chrony/molecule/default/tests/test_default.py +++ b/ansible/roles/chrony/molecule/default/tests/test_default.py @@ -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 diff --git a/ansible/roles/docker/molecule/default/molecule.yml b/ansible/roles/docker/molecule/default/molecule.yml index 10ce1f45..adc7c543 100644 --- a/ansible/roles/docker/molecule/default/molecule.yml +++ b/ansible/roles/docker/molecule/default/molecule.yml @@ -34,5 +34,3 @@ verifier: name: testinfra options: verbose: true - options: - ignore: W291 # trailing whitespace diff --git a/ansible/roles/docker/molecule/ubuntu/molecule.yml b/ansible/roles/docker/molecule/ubuntu/molecule.yml index 5abaef5b..eb907840 100644 --- a/ansible/roles/docker/molecule/ubuntu/molecule.yml +++ b/ansible/roles/docker/molecule/ubuntu/molecule.yml @@ -38,6 +38,4 @@ verifier: name: testinfra options: verbose: true - options: - ignore: W291 # trailing whitespace directory: ../default/tests/ 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 e35e21c3..41d3090b 100644 --- a/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py +++ b/ansible/roles/nfs/molecule/default/tests/test_nfs-server.py @@ -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 diff --git a/ansible/roles/package-repository/molecule/default/tests/test_infrastructure-server.py b/ansible/roles/package-repository/molecule/default/tests/test_infrastructure-server.py index 5b3fce4d..02639b6a 100644 --- a/ansible/roles/package-repository/molecule/default/tests/test_infrastructure-server.py +++ b/ansible/roles/package-repository/molecule/default/tests/test_infrastructure-server.py @@ -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 diff --git a/ansible/roles/package-repository/molecule/default/tests/test_kubernetes-node-1.py b/ansible/roles/package-repository/molecule/default/tests/test_kubernetes-node-1.py index c1831f70..06efdfc0 100644 --- a/ansible/roles/package-repository/molecule/default/tests/test_kubernetes-node-1.py +++ b/ansible/roles/package-repository/molecule/default/tests/test_kubernetes-node-1.py @@ -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 diff --git a/ansible/roles/resource-data/molecule/default/group_vars/all.yml b/ansible/roles/resource-data/molecule/default/group_vars/all.yml index 46ab3e04..0a7abb32 100644 --- a/ansible/roles/resource-data/molecule/default/group_vars/all.yml +++ b/ansible/roles/resource-data/molecule/default/group_vars/all.yml @@ -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 diff --git a/ansible/roles/resource-data/molecule/default/tests/test_default.py b/ansible/roles/resource-data/molecule/default/tests/test_default.py index 7cff76a7..c96685a6 100644 --- a/ansible/roles/resource-data/molecule/default/tests/test_default.py +++ b/ansible/roles/resource-data/molecule/default/tests/test_default.py @@ -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"] |