def test_run_once_notifications(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_once')
     dbverifier._run_once(config, pool, callback=mox.IgnoreArg())
     conn.__exit__(None, None, None)
     self.mox.ReplayAll()
     dbverifier.run_once(config)
     self.mox.VerifyAll()
示例#2
0
 def test_run_once_notifications(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_once')
     dbverifier._run_once(config, pool, callback=mox.IgnoreArg())
     conn.__exit__(None, None, None)
     self.mox.ReplayAll()
     dbverifier.run_once(config)
     self.mox.VerifyAll()
 def test_run_once_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_once')
     dbverifier._run_once(config, pool)
     self.mox.ReplayAll()
     dbverifier.run_once(config)
     self.mox.VerifyAll()
示例#4
0
 def test_run_once_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_once')
     dbverifier._run_once(config, pool)
     self.mox.ReplayAll()
     dbverifier.run_once(config)
     self.mox.VerifyAll()