Ejemplo n.º 1
0
 def test_run_notifications_with_routing_keys(self):
     config = {
         "tick_time": 30,
         "settle_time": 5,
         "settle_units": "minutes",
         "pool_size": 2,
         "enable_notifications": True,
         "rabbit": {
             "durable_queue": False,
             "host": "10.0.0.1",
             "port": 5672,
             "userid": "rabbit",
             "password": "******",
             "virtual_host": "/",
             "exchange_name": "stacktach",
         }
     }
     self.mox.StubOutWithMock(multiprocessing, 'Pool')
     pool = self.mox.CreateMockAnything()
     multiprocessing.Pool(2).AndReturn(pool)
     self.mox.StubOutWithMock(dbverifier, '_create_exchange')
     exchange = self.mox.CreateMockAnything()
     dbverifier._create_exchange('stacktach', 'topic', durable=False) \
         .AndReturn(exchange)
     self.mox.StubOutWithMock(dbverifier, '_create_connection')
     conn = self.mox.CreateMockAnything()
     dbverifier._create_connection(config).AndReturn(conn)
     conn.__enter__().AndReturn(conn)
     self.mox.StubOutWithMock(dbverifier, '_run')
     dbverifier._run(config, pool, callback=mox.IgnoreArg())
     conn.__exit__(None, None, None)
     self.mox.ReplayAll()
     dbverifier.run(config)
     self.mox.VerifyAll()
Ejemplo n.º 2
0
 def test_run_notifications_with_routing_keys(self):
     config = {
         "tick_time": 30,
         "settle_time": 5,
         "settle_units": "minutes",
         "pool_size": 2,
         "enable_notifications": True,
         "rabbit": {
             "durable_queue": False,
             "host": "10.0.0.1",
             "port": 5672,
             "userid": "rabbit",
             "password": "******",
             "virtual_host": "/",
             "exchange_name": "stacktach",
         }
     }
     self.mox.StubOutWithMock(multiprocessing, 'Pool')
     pool = self.mox.CreateMockAnything()
     multiprocessing.Pool(2).AndReturn(pool)
     self.mox.StubOutWithMock(dbverifier, '_create_exchange')
     exchange = self.mox.CreateMockAnything()
     dbverifier._create_exchange('stacktach', 'topic', durable=False) \
         .AndReturn(exchange)
     self.mox.StubOutWithMock(dbverifier, '_create_connection')
     conn = self.mox.CreateMockAnything()
     dbverifier._create_connection(config).AndReturn(conn)
     conn.__enter__().AndReturn(conn)
     self.mox.StubOutWithMock(dbverifier, '_run')
     dbverifier._run(config, pool, callback=mox.IgnoreArg())
     conn.__exit__(None, None, None)
     self.mox.ReplayAll()
     dbverifier.run(config)
     self.mox.VerifyAll()
Ejemplo n.º 3
0
 def test_run_no_notifications(self):
     config = {
         "tick_time": 30,
         "settle_time": 5,
         "settle_units": "minutes",
         "pool_size": 2,
         "enable_notifications": False,
     }
     self.mox.StubOutWithMock(multiprocessing, 'Pool')
     pool = self.mox.CreateMockAnything()
     multiprocessing.Pool(2).AndReturn(pool)
     self.mox.StubOutWithMock(dbverifier, '_run')
     dbverifier._run(config, pool)
     self.mox.ReplayAll()
     dbverifier.run(config)
     self.mox.VerifyAll()
Ejemplo n.º 4
0
 def test_run_no_notifications(self):
     config = {
         "tick_time": 30,
         "settle_time": 5,
         "settle_units": "minutes",
         "pool_size": 2,
         "enable_notifications": False,
     }
     self.mox.StubOutWithMock(multiprocessing, 'Pool')
     pool = self.mox.CreateMockAnything()
     multiprocessing.Pool(2).AndReturn(pool)
     self.mox.StubOutWithMock(dbverifier, '_run')
     dbverifier._run(config, pool)
     self.mox.ReplayAll()
     dbverifier.run(config)
     self.mox.VerifyAll()