Example #1
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client)
     app.get('/stats_unique_cell.json', status=200)
Example #2
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client)
     app.get('/stats_unique_cell.json', status=200)
Example #3
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db(create=False)
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=get_client('ichnaea'))
     app.get('/stats_location.json', status=200)
Example #4
0
 def test_redis_config(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client, **settings)
     self.assertTrue(app.app.registry.redis_client is not None)
Example #5
0
 def test_redis_config(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }
     app = _make_app(_raven_client=self.raven_client,
                     _stats_client=self.stats_client, **settings)
     self.assertTrue(app.app.registry.redis_client is not None)
Example #6
0
 def test_redis_config(self):
     app_config = DummyConfig({'ichnaea': {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         'redis_url': REDIS_URI,
     }})
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     self.assertTrue(app.app.registry.redis_client is not None)
Example #7
0
 def test_db_config(self):
     self.db_rw = _make_db()
     self.db_ro = _make_db()
     self.setup_session()
     app = _make_app(_db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     )
     app.get('/stats_wifi.json', status=200)
Example #8
0
 def test_db_config(self):
     self.db_rw = _make_db()
     self.db_ro = _make_db()
     self.setup_session()
     app = _make_app(_db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     app.get('/stats_wifi.json', status=200)
Example #9
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         '_heka_client': self.heka_client,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_unique_cell.json', status=200)
Example #10
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
         '_heka_client': self.heka_client,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_unique_cell.json', status=200)
Example #11
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(_db_master=self.db_master,
                     _db_slave=self.db_slave,
                     _heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     )
     app.get('/stats_wifi.json', status=200)
Example #12
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_master_socket': SQLSOCKET,
         'db_slave': SQLURI,
         'db_slave_socket': SQLSOCKET,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_location.json', status=200)
Example #13
0
 def test_redis_config(self):
     app_config = DummyConfig({
         'ichnaea': {
             'db_master': SQLURI,
             'db_slave': SQLURI,
             'redis_url': REDIS_URI,
         }
     })
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     self.assertTrue(app.app.registry.redis_client is not None)
Example #14
0
 def test_db_hooks(self):
     db_rw = _make_db()
     db_ro = _make_db()
     app = _make_app(_db_rw=db_rw,
                     _db_ro=db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     # check that our _db hooks are passed through
     self.assertTrue(app.app.registry.db_rw is db_rw)
     self.assertTrue(app.app.registry.db_ro is db_ro)
Example #15
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db()
     self.setup_session()
     app = _make_app(
         _db_master=self.db_master,
         _db_slave=self.db_slave,
         _heka_client=self.heka_client,
         _stats_client=self.stats_client,
         _redis=self.redis_client,
     )
     app.get('/stats_wifi.json', status=200)
Example #16
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_master_socket': SQLSOCKET,
         'db_slave': SQLURI,
         'db_slave_socket': SQLSOCKET,
     }
     app = _make_app(**settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_location.json', status=200)
Example #17
0
 def test_db_hooks(self):
     db_rw = _make_db()
     db_ro = _make_db()
     app = _make_app(_db_rw=db_rw,
                     _db_ro=db_ro,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     # check that our _db hooks are passed through
     self.assertTrue(app.app.registry.db_rw is db_rw)
     self.assertTrue(app.app.registry.db_ro is db_ro)
Example #18
0
 def test_redis_config(self):
     app_config = DummyConfig({"cache": {"cache_url": REDIS_URI}})
     app = _make_app(
         app_config=app_config,
         _db_rw=self.db_rw,
         _db_ro=self.db_ro,
         _raven_client=self.raven_client,
         _stats_client=self.stats_client,
     )
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(redis_client.connection_pool.connection_kwargs["db"], 1)
Example #19
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     **settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Example #20
0
 def test_redis_config(self):
     app_config = DummyConfig({'ichnaea': {
         'redis_url': REDIS_URI,
     }})
     app = _make_app(app_config=app_config,
                     _db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(
         redis_client.connection_pool.connection_kwargs['db'], 1)
Example #21
0
 def test_db_hooks(self):
     settings = {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }
     app = _make_app(_heka_client=self.heka_client,
                     _stats_client=self.stats_client,
                     _redis=self.redis_client,
                     **settings)
     self.db_master = app.app.registry.db_master
     self.db_slave = app.app.registry.db_slave
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Example #22
0
 def test_db_hooks(self):
     app_config = DummyConfig({'ichnaea': {
         'db_master': SQLURI,
         'db_slave': SQLURI,
     }})
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     self.db_rw = app.app.registry.db_rw
     self.db_ro = app.app.registry.db_ro
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Example #23
0
 def test_redis_config(self):
     app_config = DummyConfig({
         'cache': {
             'cache_url': REDIS_URI,
         },
     })
     app = _make_app(app_config=app_config,
                     _db_rw=self.db_rw,
                     _db_ro=self.db_ro,
                     _raven_client=self.raven_client,
                     _stats_client=self.stats_client)
     redis_client = app.app.registry.redis_client
     self.assertTrue(redis_client is not None)
     self.assertEqual(redis_client.connection_pool.connection_kwargs['db'],
                      1)
Example #24
0
 def test_db_hooks(self):
     app_config = DummyConfig(
         {'ichnaea': {
             'db_master': SQLURI,
             'db_slave': SQLURI,
         }})
     app = _make_app(
         app_config=app_config,
         _raven_client=self.raven_client,
         _redis_client=self.redis_client,
         _stats_client=self.stats_client,
     )
     self.db_rw = app.app.registry.db_rw
     self.db_ro = app.app.registry.db_ro
     self.setup_session()
     app.get('/stats_wifi.json', status=200)
Example #25
0
 def test_db_config(self):
     app_config = DummyConfig({"database": {"rw_url": SQLURI, "ro_url": SQLURI}})
     app = _make_app(
         app_config=app_config,
         _raven_client=self.raven_client,
         _redis_client=self.redis_client,
         _stats_client=self.stats_client,
     )
     db_rw = app.app.registry.db_rw
     db_ro = app.app.registry.db_ro
     # the configured databases are working
     try:
         self.assertTrue(db_rw.ping())
         self.assertTrue(db_ro.ping())
     finally:
         # clean up the new db engine's _make_app created
         db_rw.engine.pool.dispose()
         db_ro.engine.pool.dispose()
Example #26
0
 def test_db_config(self):
     app_config = DummyConfig({
         'database': {
             'rw_url': SQLURI,
             'ro_url': SQLURI,
         },
     })
     app = _make_app(app_config=app_config,
                     _raven_client=self.raven_client,
                     _redis_client=self.redis_client,
                     _stats_client=self.stats_client,
                     )
     db_rw = app.app.registry.db_rw
     db_ro = app.app.registry.db_ro
     # the configured databases are working
     try:
         self.assertTrue(db_rw.ping())
         self.assertTrue(db_ro.ping())
     finally:
         # clean up the new db engine's _make_app created
         db_rw.engine.pool.dispose()
         db_ro.engine.pool.dispose()
Example #27
0
 def test_db_config(self):
     self.db_master = _make_db()
     self.db_slave = _make_db(create=False)
     self.setup_session()
     app = _make_app(_db_master=self.db_master, _db_slave=self.db_slave)
     app.get('/stats_location.json', status=200)