Exemplo n.º 1
0
 def test_get_service_info(self):
     expected = [
         'haproxy (1)', 'keepalived (2)',
         'neutron-keepalived-state-change (2)',
         'neutron-ovn-metadata-agent (3)', 'nova-api-metadata (5)',
         'nova-compute (1)', 'qemu-system-x86_64 (1)'
     ]
     openstack_services.get_openstack_service_checker()()
     self.assertEqual(openstack_services.OPENSTACK_INFO["services"],
                      expected)
Exemplo n.º 2
0
    def test_get_release_info(self):
        with tempfile.TemporaryDirectory() as dtmp:
            for rel in ["stein", "ussuri", "train"]:
                with open(os.path.join(dtmp,
                                       "cloud-archive-{}.list".format(rel)),
                          'w') as fd:
                    fd.write(APT_UCA.format(rel))

            with mock.patch.object(openstack_services, "APT_SOURCE_PATH",
                                   dtmp):
                openstack_services.get_openstack_service_checker()()
                self.assertEqual(openstack_services.OPENSTACK_INFO["release"],
                                 "ussuri")
Exemplo n.º 3
0
    def test_get_debug_log_info(self):
        expected = {'neutron': True, 'nova': True}
        with tempfile.TemporaryDirectory() as dtmp:
            for svc in ["nova", "neutron"]:
                conf_path = "etc/{svc}/{svc}.conf".format(svc=svc)
                os.makedirs(os.path.dirname(os.path.join(dtmp, conf_path)))
                with open(os.path.join(dtmp, conf_path), 'w') as fd:
                    fd.write(SVC_CONF)

            with mock.patch.object(openstack_services.constants,
                                   "DATA_ROOT", dtmp):
                openstack_services.get_openstack_service_checker()()
                result = openstack_services.OPENSTACK_INFO[
                                                       'debug-logging-enabled']
                self.assertEqual(result, expected)