mike-senin / mk-post-deployment-checks

in progress
BSD 2-Clause "Simplified" License
1 stars 8 forks source link

Attribite error for apt and cadf nodes #61

Open mike-senin opened 7 years ago

mike-senin commented 7 years ago
(.venv)(jpe2)root@cfg-01:/home/msenin/mk-post-deployment-checks/mk_verificator/tests# pytest -sv repo_list/test_repo_list.py 
=========================================================================================== test session starts ============================================================================================
platform linux2 -- Python 2.7.6, pytest-3.0.6, py-1.4.32, pluggy-0.4.0 -- /usr/bin/python
cachedir: ../../.cache
rootdir: /home/msenin/mk-post-deployment-checks, inifile: 
collected 21 items 

repo_list/test_repo_list.py::test_list_of_repo_on_nodes[ceph*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[cpu*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[ntw*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[kvm*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[rmq*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[ctl*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[bmk*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[log*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[jmp*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[cfg*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[apt*] FAILED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[consul*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[asc*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[mtr*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[nal*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[sql*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[prx*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[cadf*] FAILED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[saml*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[mon*] PASSED
repo_list/test_repo_list.py::test_list_of_repo_on_nodes[des*] PASSED

================================================================================================= FAILURES =================================================================================================
_____________________________________________________________________________________ test_list_of_repo_on_nodes[apt*] _____________________________________________________________________________________

local_salt_client = <salt.client.LocalClient object at 0x7f3ad89f2a90>, node = 'apt*'

    @pytest.mark.parametrize(
        ("node"),
        utils.get_groups(utils.get_configuration(__file__))
    )
    def test_list_of_repo_on_nodes(local_salt_client, node):
        info_salt = local_salt_client.cmd(
            node,
            'pillar.data',
            ['linux:system:repo']
        )

        raw_actual_info = local_salt_client.cmd(
            node,
            'cmd.run',
            ['cat /etc/apt/sources.list.d/*;cat /etc/apt/sources.list|grep deb'])

        actual_repo_list = [item.replace('/ ', ' ')
                            for item in raw_actual_info.values()[0].split('\n')]

        expected_salt_data = [
            repo['source'].replace('/ ', ' ')
>           for repo in info_salt.values()[0]['linux:system:repo'].values()
        ]
E       AttributeError: 'str' object has no attribute 'values'

repo_list/test_repo_list.py:27: AttributeError
____________________________________________________________________________________ test_list_of_repo_on_nodes[cadf*] _____________________________________________________________________________________

local_salt_client = <salt.client.LocalClient object at 0x7f3ad8a33810>, node = 'cadf*'

    @pytest.mark.parametrize(
        ("node"),
        utils.get_groups(utils.get_configuration(__file__))
    )
    def test_list_of_repo_on_nodes(local_salt_client, node):
        info_salt = local_salt_client.cmd(
            node,
            'pillar.data',
            ['linux:system:repo']
        )

        raw_actual_info = local_salt_client.cmd(
            node,
            'cmd.run',
            ['cat /etc/apt/sources.list.d/*;cat /etc/apt/sources.list|grep deb'])

        actual_repo_list = [item.replace('/ ', ' ')
                            for item in raw_actual_info.values()[0].split('\n')]

        expected_salt_data = [
            repo['source'].replace('/ ', ' ')
>           for repo in info_salt.values()[0]['linux:system:repo'].values()
        ]
E       AttributeError: 'str' object has no attribute 'values'

repo_list/test_repo_list.py:27: AttributeError
=================================================================================== 2 failed, 19 passed in 69.93 seconds ===================================================================================