Beispiel #1
0
class TestYamlFs:

    def setUp(self):
        self._storage = ExternalNodeStorage(os.path.join(PWD, 'nodes'),
                                            os.path.join(PWD, 'classes'),
                                            POSTFIX)
        self._inventory = self._storage.inventory()

    def test_inventory_setup(self):
        assert isinstance(self._inventory, dict)
        print self._inventory
        assert len(self._inventory['groups']) == len(MEMBERSHIPS)
        for i in MEMBERSHIPS.iterkeys():
            assert i in self._inventory['groups']

    def test_inventory_memberships(self):
        for app, members in self._inventory['groups'].iteritems():
            for i in MEMBERSHIPS[app]:
                assert i in members
        for app, members in MEMBERSHIPS.iteritems():
            for i in self._inventory['groups'][app]:
                assert i in members

    def test_host_meta(self):
        for n in HOSTS:
            node = self._storage.nodeinfo(n)
            assert '__reclass__' in node

    def test_host_entity(self):
        for n in HOSTS:
            node = self._storage.nodeinfo(n)
            assert 'applications' in node
            assert 'classes' in node
            assert 'parameters' in node

    def test_merge_empty_dict(self):
        node = self._storage.nodeinfo(HOSTS[0])
        assert 'apt' in node['parameters']
        assert node['parameters']['apt'] is not None

    def test_merge_parameters(self):
        node = self._storage.nodeinfo(HOSTS[1])
        assert node['parameters']['apt']['mirror_base'] == 'uni-erlangen'
Beispiel #2
0
 def setUp(self):
     self._storage = ExternalNodeStorage(os.path.join(PWD, 'nodes'),
                                         os.path.join(PWD, 'classes'),
                                         POSTFIX)
     self._inventory = self._storage.inventory()