Exemplo n.º 1
0
 def _create_board(self, persistence=None):
     client = fake_client.FakeClient()
     board = impl_zookeeper.ZookeeperJobBoard('test-board', {},
                                              client=client,
                                              persistence=persistence)
     self.addCleanup(board.close)
     self.addCleanup(kazoo_utils.finalize_client, client)
     return (client, board)
Exemplo n.º 2
0
 def make_components(self, name='testing', wait_timeout=0.1):
     client = fake_client.FakeClient()
     persistence = impl_memory.MemoryBackend()
     board = impl_zookeeper.ZookeeperJobBoard(name, {},
                                              client=client,
                                              persistence=persistence)
     conductor = stc.SingleThreadedConductor(name, board, persistence,
                                             wait_timeout=wait_timeout)
     return self.ComponentBundle(board, client, persistence, conductor)
Exemplo n.º 3
0
 def make_components(self):
     client = fake_client.FakeClient()
     persistence = impl_memory.MemoryBackend()
     board = impl_zookeeper.ZookeeperJobBoard('testing', {},
                                              client=client,
                                              persistence=persistence)
     conductor_kwargs = self.conductor_kwargs.copy()
     conductor_kwargs['persistence'] = persistence
     conductor = backends.fetch(self.kind, 'testing', board,
                                **conductor_kwargs)
     return ComponentBundle(board, client, persistence, conductor)
Exemplo n.º 4
0
 def test_bad_factory(self):
     persistence = impl_memory.MemoryBackend()
     client = fake_client.FakeClient()
     board = impl_zookeeper.ZookeeperJobBoard('testing', {},
                                              client=client,
                                              persistence=persistence)
     self.assertRaises(ValueError,
                       backends.fetch,
                       'nonblocking',
                       'testing',
                       board,
                       persistence=persistence,
                       executor_factory='testing')
Exemplo n.º 5
0
    def create_board(self, persistence=None):
        def cleanup_path(client, path):
            if not client.connected:
                return
            client.delete(path, recursive=True)

        client = kazoo_utils.make_client(test_utils.ZK_TEST_CONFIG.copy())
        path = TEST_PATH_TPL % (uuidutils.generate_uuid())
        board = impl_zookeeper.ZookeeperJobBoard('test-board', {'path': path},
                                                 client=client,
                                                 persistence=persistence)
        self.addCleanup(self.close_client, client)
        self.addCleanup(cleanup_path, client, path)
        self.addCleanup(board.close)
        return (client, board)
Exemplo n.º 6
0
def create_board(**kwargs):
    client = fake_client.FakeClient()
    board = impl_zookeeper.ZookeeperJobBoard('test-board',
                                             conf=dict(kwargs),
                                             client=client)
    return (client, board)