def _test_required_attributes(self, resources):
        self.assertTrue(len(resources) > 0)
        for host, attributes in six.iteritems(resources):
            for attribute in self.required_attributes:
                self.assertIn(attribute, attributes)
                self.assertIsNotNone(attributes[attribute])
                self.assertNotEqual(attributes[attribute], "")

            if host == ResourceGenerator._server_node_name:
                expected = self.server_grains
                self.assertIn(host, resources)
                self.assertEqual(resources[host]["hostname"], host)
            else:
                expected = self.mine[host]
                self.assertIn(host, resources)
                self.assertEqual(resources[host]["hostname"], expected["fqdn"])

            self.assertEqual(
                resources[host]["osArch"],
                ResourceGenerator._os_arch(expected["cpuarch"]),
            )
            self.assertEqual(
                resources[host]["osFamily"],
                ResourceGenerator._os_family(expected["kernel"]),
            )
            self.assertEqual(resources[host]["osName"], expected["kernel"])
            self.assertEqual(resources[host]["osVersion"],
                             expected["kernelrelease"])
示例#2
0
    def _test_required_attributes(self, resources):
        self.assertTrue(len(resources) > 0)
        for host, attributes in resources.iteritems():
            for attribute in self.required_attributes:
                self.assertIn(attribute, attributes)
                self.assertIsNotNone(attributes[attribute])
                self.assertNotEqual(attributes[attribute], '')

            if host == ResourceGenerator._server_node_name:
                expected = self.server_grains
                self.assertIn(host, resources)
                self.assertEqual(resources[host]['hostname'], host)
            else:
                expected = self.mine[host]
                self.assertIn(host, resources)
                self.assertEqual(
                    resources[host]['hostname'],
                    expected['fqdn'])

            self.assertEqual(
                resources[host]['osArch'],
                ResourceGenerator._os_arch(expected['cpuarch']))
            self.assertEqual(
                resources[host]['osFamily'],
                ResourceGenerator._os_family(expected['kernel']))
            self.assertEqual(
                resources[host]['osName'],
                expected['kernel'])
            self.assertEqual(
                resources[host]['osVersion'],
                expected['kernelrelease'])
示例#3
0
 def test_os_arch_map2(self):
     os_arch = ResourceGenerator._os_arch('unknown')
     self.assertEqual(os_arch, 'unknown')
示例#4
0
 def test_os_arch_map1(self):
     os_arch = ResourceGenerator._os_arch('x86_64')
     self.assertEqual(os_arch, 'amd64')
 def test_os_arch_map3(self):
     os_arch = ResourceGenerator._os_arch("unknown")
     self.assertEqual(os_arch, "unknown")
 def test_os_arch_map2(self):
     os_arch = ResourceGenerator._os_arch("AMD64")
     self.assertEqual(os_arch, "amd64")