Пример #1
0
def txnPoolNodeSet(node_config_helper_class,
                   patchPluginManager,
                   txnPoolNodesLooper,
                   tdirWithPoolTxns,
                   tdirWithDomainTxns,
                   tdir,
                   tconf,
                   poolTxnNodeNames,
                   allPluginsPath,
                   tdirWithNodeKeepInited,
                   testNodeClass,
                   do_post_node_creation,
                   testNodeBootstrapClass):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(create_new_test_node(
                testNodeClass, node_config_helper_class, nm, tconf, tdir,
                allPluginsPath, bootstrap_cls=testNodeBootstrapClass))
            do_post_node_creation(node)
            txnPoolNodesLooper.add(node)
            nodes.append(node)
        txnPoolNodesLooper.run(checkNodesConnected(nodes))
        ensureElectionsDone(looper=txnPoolNodesLooper, nodes=nodes)
        yield nodes
Пример #2
0
def create_node_and_not_start(testNodeClass, node_config_helper_class, tconf,
                              tdir, allPluginsPath, looper, tdirWithPoolTxns,
                              tdirWithDomainTxns, tdirWithNodeKeepInited):
    with ExitStack() as exitStack:
        node = exitStack.enter_context(
            create_new_test_node(testNodeClass, node_config_helper_class,
                                 "Alpha", tconf, tdir, allPluginsPath))
        yield node
        node.stop()
Пример #3
0
def txnPoolNodeSetNotStarted(node_config_helper_class, patchPluginManager,
                             txnPoolNodesLooper, tdirWithPoolTxns,
                             tdirWithDomainTxns, tdir, tconf, poolTxnNodeNames,
                             allPluginsPath, tdirWithNodeKeepInited,
                             testNodeClass, do_post_node_creation):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(
                create_new_test_node(testNodeClass, node_config_helper_class,
                                     nm, tconf, tdir, allPluginsPath))
            do_post_node_creation(node)
            nodes.append(node)
        yield nodes
Пример #4
0
def create_replayable_node_and_check(looper, all_nodes, node_to_check,
                                     replayable_node_class,
                                     node_config_helper_class, conf,
                                     basedirpath, allPluginsPath):
    print('-------------Replaying node {} now---------------------'.format(
        node_to_check))
    new_node_name = node_to_check.name
    replaying_node = create_new_test_node(replayable_node_class,
                                          node_config_helper_class,
                                          new_node_name, conf, basedirpath,
                                          allPluginsPath)
    for n in all_nodes:
        assert replaying_node.domainLedger.size < n.domainLedger.size
    replay_and_compare(looper, node_to_check, replaying_node)
Пример #5
0
def create_replayable_node_and_check(looper, all_nodes, node_to_check,
                                     replayable_node_class,
                                     node_config_helper_class, conf,
                                     basedirpath, allPluginsPath):
    print(
        '-------------Replaying node {} now---------------------'.format(node_to_check))
    new_node_name = node_to_check.name
    replaying_node = create_new_test_node(
        replayable_node_class, node_config_helper_class, new_node_name,
        conf, basedirpath, allPluginsPath, node_ha=node_to_check.nodestack.ha,
        client_ha=node_to_check.clientstack.ha)
    for n in all_nodes:
        assert replaying_node.domainLedger.size < n.domainLedger.size
    replay_and_compare(looper, node_to_check, replaying_node)
Пример #6
0
def testNode(pluginManager, node_config_helper_class, txnPoolNodesLooper,
             tdirWithPoolTxns, tdirWithDomainTxns, tdir, tconf, allPluginsPath,
             tdirWithNodeKeepInited, do_post_node_creation, poolTxnNodeNames):
    node = None
    for p in txnPoolNodesLooper.prodables:
        if 'Alpha' == p.name:
            node = p
    if not node:
        node = create_new_test_node(TestNode, node_config_helper_class,
                                    'Alpha', tconf, tdir, None)
        do_post_node_creation(node)
        txnPoolNodesLooper.add(node)
        txnPoolNodesLooper.run(checkNodesConnected([node]))
    yield node
    node.stop()
Пример #7
0
def txnPoolNodeSetWithElector(node_config_helper_class, patchPluginManager,
                              tdirWithPoolTxns, tdirWithDomainTxns, tdir,
                              tconf, poolTxnNodeNames, allPluginsPath,
                              tdirWithNodeKeepInited, testNodeClass,
                              do_post_node_creation):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(
                create_new_test_node(testNodeClass, node_config_helper_class,
                                     nm, tconf, tdir, allPluginsPath))
            do_post_node_creation(node)
            nodes.append(node)
        assert len(nodes) == 7
        for node in nodes:
            node.view_changer = node.newViewChanger()
            node.elector = node.newPrimaryDecider()
        yield nodes
Пример #8
0
def create_node_and_not_start(testNodeClass,
                              node_config_helper_class,
                              tconf,
                              tdir,
                              allPluginsPath,
                              looper,
                              tdirWithPoolTxns,
                              tdirWithDomainTxns,
                              tdirWithNodeKeepInited):
    with ExitStack() as exitStack:
        node = exitStack.enter_context(create_new_test_node(testNodeClass,
                                node_config_helper_class,
                                "Alpha",
                                tconf,
                                tdir,
                                allPluginsPath))
        yield node
        node.stop()
def txnPoolNodeSet(node_config_helper_class, patchPluginManager,
                   txnPoolNodesLooper, tdirWithPoolTxns, tdirWithDomainTxns,
                   tdir, tconf, poolTxnNodeNames, allPluginsPath,
                   tdirWithNodeKeepInited, testNodeClass,
                   do_post_node_creation, request):
    update_conf(tconf, request.param)
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(
                create_new_test_node(testNodeClass, node_config_helper_class,
                                     nm, tconf, tdir, allPluginsPath))
            do_post_node_creation(node)
            txnPoolNodesLooper.add(node)
            nodes.append(node)
        txnPoolNodesLooper.run(checkNodesConnected(nodes))
        ensureElectionsDone(looper=txnPoolNodesLooper, nodes=nodes)
        yield nodes
        for node in nodes:
            txnPoolNodesLooper.removeProdable(node)
Пример #10
0
def txnPoolNodeSetNotStarted(node_config_helper_class,
                             patchPluginManager,
                             txnPoolNodesLooper,
                             tdirWithPoolTxns,
                             tdirWithDomainTxns,
                             tdir,
                             tconf,
                             poolTxnNodeNames,
                             allPluginsPath,
                             tdirWithNodeKeepInited,
                             testNodeClass,
                             do_post_node_creation):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(create_new_test_node(
                testNodeClass, node_config_helper_class, nm, tconf, tdir,
                allPluginsPath))
            do_post_node_creation(node)
            nodes.append(node)
        yield nodes
def txnPoolNodeSetWithElector(node_config_helper_class,
                              patchPluginManager,
                              tdirWithPoolTxns,
                              tdirWithDomainTxns,
                              tdir,
                              tconf,
                              poolTxnNodeNames,
                              allPluginsPath,
                              tdirWithNodeKeepInited,
                              testNodeClass,
                              do_post_node_creation):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(create_new_test_node(
                testNodeClass, node_config_helper_class, nm, tconf, tdir,
                allPluginsPath))
            do_post_node_creation(node)
            nodes.append(node)
        assert len(nodes) == 7
        for node in nodes:
            node.view_changer = node.newViewChanger()
            node.elector = node.newPrimaryDecider()
        yield nodes
Пример #12
0
def testNode(pluginManager,
             node_config_helper_class,
             txnPoolNodesLooper,
             tdirWithPoolTxns,
             tdirWithDomainTxns,
             tdir,
             tconf,
             allPluginsPath,
             tdirWithNodeKeepInited,
             do_post_node_creation,
             poolTxnNodeNames):
    node = None
    for p in txnPoolNodesLooper.prodables:
        if 'Alpha' == p.name:
            node = p
    if not node:
        node = create_new_test_node(
            TestNode, node_config_helper_class, 'Alpha', tconf, tdir,
            None)
        do_post_node_creation(node)
        txnPoolNodesLooper.add(node)
        txnPoolNodesLooper.run(checkNodesConnected([node]))
    yield node
    node.stop()
Пример #13
0
def txnPoolNodeSet(node_config_helper_class,
                   patchPluginManager,
                   txnPoolNodesLooper,
                   tdirWithPoolTxns,
                   tdirWithDomainTxns,
                   tdir,
                   tconf,
                   poolTxnNodeNames,
                   allPluginsPath,
                   tdirWithNodeKeepInited,
                   testNodeClass,
                   do_post_node_creation):
    with ExitStack() as exitStack:
        nodes = []
        for nm in poolTxnNodeNames:
            node = exitStack.enter_context(create_new_test_node(
                testNodeClass, node_config_helper_class, nm, tconf, tdir,
                allPluginsPath))
            do_post_node_creation(node)
            txnPoolNodesLooper.add(node)
            nodes.append(node)
        txnPoolNodesLooper.run(checkNodesConnected(nodes))
        ensureElectionsDone(looper=txnPoolNodesLooper, nodes=nodes)
        yield nodes