Exemplo n.º 1
0
 def test_set_hook(self):
     with mock.patch.object(osprofiler.sqlalchemy,
                            'add_tracing') as profiler:
         cfg.CONF.set_override('enabled', True, group='profiler')
         cfg.CONF.set_override('trace_sqlalchemy', True, group='profiler')
         engine_mock = mock.Mock()
         db_api.set_hook(engine_mock)
         profiler.assert_called_with(sqlalchemy, engine_mock, 'neutron.db')
Exemplo n.º 2
0
 def test_set_hook(self):
     with mock.patch.object(osprofiler.sqlalchemy,
                            'add_tracing') as profiler:
         cfg.CONF.set_override('enabled', True, group='profiler')
         cfg.CONF.set_override('trace_sqlalchemy', True, group='profiler')
         engine_mock = mock.Mock()
         db_api.set_hook(engine_mock)
         profiler.assert_called_with(sqlalchemy, engine_mock,
                                     'neutron.db')
Exemplo n.º 3
0
 def test_set_hook(self):
     with mock.patch.object(osprofiler.opts, 'is_trace_enabled',
                            return_value=True),\
          mock.patch.object(osprofiler.opts, 'is_db_trace_enabled',
                            return_value=True):
         with mock.patch.object(osprofiler.sqlalchemy,
                 'add_tracing') as add_tracing:
             engine_mock = mock.Mock()
             db_api.set_hook(engine_mock)
             add_tracing.assert_called_with(sqlalchemy, engine_mock,
                                            'neutron.db')
Exemplo n.º 4
0
 def test_set_hook(self):
     with mock.patch.object(osprofiler.opts, 'is_trace_enabled',
                            return_value=True),\
          mock.patch.object(osprofiler.opts, 'is_db_trace_enabled',
                            return_value=True):
         with mock.patch.object(osprofiler.sqlalchemy,
                 'add_tracing') as add_tracing:
             engine_mock = mock.Mock()
             db_api.set_hook(engine_mock)
             add_tracing.assert_called_with(sqlalchemy, engine_mock,
                                            'neutron.db')