Beispiel #1
0
    def test_ensure_local_port_host_binding(
        self,
        get_local_service_ip,
        shuffle_notifications,
        health,
        populate,
        scheduler,
        notifications,
        multiprocessing,
        akanda_wrapper,
        importutils,
    ):

        self.test_config.config(plug_external_port=False)

        def side_effect(**kwarg):
            return {"ports": {}}

        akanda_wrapper.return_value.list_ports.side_effect = side_effect

        main.main(argv=self.argv)
        args, kwargs = akanda_wrapper.return_value.create_port.call_args
        port = args[0]["port"]
        self.assertIn("binding:host_id", port)
        self.assertEqual(port["binding:host_id"], socket.gethostname())
Beispiel #2
0
 def test_ensure_local_service_port(self, shuffle_notifications, health,
                                    populate, scheduler, notifications,
                                    multiprocessing, quantum_api, cfg,
                                    keystone):
     main.main()
     quantum = quantum_api.Quantum.return_value
     quantum.ensure_local_service_port.assert_called_once_with()
Beispiel #3
0
 def test_ceilometer_enabled(
     self, shuffle_notifications, health, populate, scheduler, notifications, multiprocessing, neutron_api
 ):
     self.test_config.config(enabled=True, group="ceilometer")
     notifications.Publisher = mock.Mock(spec=ak_notifications.Publisher)
     notifications.NoopPublisher = mock.Mock(spec=ak_notifications.NoopPublisher)
     main.main(argv=self.argv)
     self.assertEqual(len(notifications.Publisher.mock_calls), 2)
     self.assertEqual(len(notifications.NoopPublisher.mock_calls), 0)
Beispiel #4
0
 def test_ceilometer_enabled(self, shuffle_notifications, health,
                             populate, scheduler, notifications,
                             multiprocessing, neutron_api, cfg):
     cfg.CONF.ceilometer.enabled = True
     notifications.Publisher = mock.Mock(spec=ak_notifications.Publisher)
     notifications.NoopPublisher = mock.Mock(
         spec=ak_notifications.NoopPublisher)
     main.main()
     self.assertEqual(len(notifications.Publisher.mock_calls), 1)
     self.assertEqual(len(notifications.NoopPublisher.mock_calls), 0)
Beispiel #5
0
 def test_ceilometer_enabled(self, shuffle_notifications, health, populate,
                             scheduler, notifications, multiprocessing,
                             quantum_api, cfg):
     cfg.CONF.ceilometer.enabled = True
     notifications.Publisher = mock.Mock(spec=ak_notifications.Publisher)
     notifications.NoopPublisher = mock.Mock(
         spec=ak_notifications.NoopPublisher)
     main.main()
     self.assertEqual(len(notifications.Publisher.mock_calls), 1)
     self.assertEqual(len(notifications.NoopPublisher.mock_calls), 0)
Beispiel #6
0
 def test_ceilometer_enabled(self, shuffle_notifications, health, populate,
                             scheduler, notifications, multiprocessing,
                             neutron_api):
     self.test_config.config(enabled=True, group='ceilometer')
     notifications.Publisher = mock.Mock(spec=ak_notifications.Publisher)
     notifications.NoopPublisher = mock.Mock(
         spec=ak_notifications.NoopPublisher)
     main.main(argv=self.argv)
     self.assertEqual(len(notifications.Publisher.mock_calls), 2)
     self.assertEqual(len(notifications.NoopPublisher.mock_calls), 0)
Beispiel #7
0
    def test_ensure_local_port_host_binding(
            self, get_local_service_ip, shuffle_notifications, health,
            populate, scheduler, notifications, multiprocessing,
            akanda_wrapper, importutils, cfg):

        cfg.CONF.plug_external_port = False

        def side_effect(**kwarg):
            return {'ports': {}}
        akanda_wrapper.return_value.list_ports.side_effect = side_effect

        main.main()
        args, kwargs = akanda_wrapper.return_value.create_port.call_args
        port = args[0]['port']
        self.assertIn('binding:host_id', port)
        self.assertEqual(port['binding:host_id'], socket.gethostname())
Beispiel #8
0
    def test_ensure_local_port_host_binding(self, get_local_service_ip,
                                            shuffle_notifications, health,
                                            populate, scheduler, notifications,
                                            multiprocessing, akanda_wrapper,
                                            importutils, cfg):

        cfg.CONF.plug_external_port = False

        def side_effect(**kwarg):
            return {'ports': {}}

        akanda_wrapper.return_value.list_ports.side_effect = side_effect

        main.main()
        args, kwargs = akanda_wrapper.return_value.create_port.call_args
        port = args[0]['port']
        self.assertIn('binding:host_id', port)
        self.assertEqual(port['binding:host_id'], socket.gethostname())
Beispiel #9
0
 def test_ensure_local_service_port(self, shuffle_notifications, health,
                                    populate, scheduler, notifications,
                                    multiprocessing, neutron_api, cfg):
     main.main()
     neutron = neutron_api.Neutron.return_value
     neutron.ensure_local_service_port.assert_called_once_with()
Beispiel #10
0
 def test_ensure_local_service_port(self, shuffle_notifications, health,
                                    populate, scheduler, notifications,
                                    multiprocessing, quantum_api, cfg):
     main.main()
     quantum = quantum_api.Quantum.return_value
     quantum.ensure_local_service_port.assert_called_once_with()
Beispiel #11
0
 def test_ensure_local_service_port(self, shuffle_notifications, health,
                                    populate, scheduler, notifications,
                                    multiprocessing, neutron_api):
     main.main(argv=self.argv)
     neutron = neutron_api.Neutron.return_value
     neutron.ensure_local_service_port.assert_called_once_with()