def multiPoolNodesCreated(request, tconf, looper, tdir, cliTempLogger, namesOfPools=("pool1", "pool2")): multiNodes = [] for poolName in namesOfPools: newPoolTxnNodeNames = [ poolName + n for n in ("Alpha", "Beta", "Gamma", "Delta") ] config_helper = ConfigHelper(tconf, chroot=tdir) ledger_dir = os.path.join(config_helper.ledger_base_dir, poolName) newPoolTxnData = getPoolTxnData(poolName, newPoolTxnNodeNames) newTdirWithPoolTxns = custom_tdir_with_pool_txns( newPoolTxnData, ledger_dir, tconf.poolTransactionsFile) newTdirWithDomainTxns = custom_tdir_with_domain_txns( newPoolTxnData, ledger_dir, domainTxnOrderedFields(), tconf.domainTransactionsFile) testPoolNode = TestMultiNode(poolName, newPoolTxnNodeNames, tdir, tconf, newPoolTxnData, newTdirWithPoolTxns, newTdirWithDomainTxns, None) poolCLIBabyGen = CliBuilder(tdir, newTdirWithPoolTxns, newTdirWithDomainTxns, looper, tconf, cliTempLogger) poolCLIBaby = next(poolCLIBabyGen(poolName)) # Ugly hack to build several networks network_bak = tconf.NETWORK_NAME tconf.NETWORK_NAME = poolName tdirWithNodeKeepInited(tdir, tconf, NodeConfigHelper, newPoolTxnData, newPoolTxnNodeNames) nodes = [] for nm in newPoolTxnNodeNames: config_helper = NodeConfigHelper(nm, tconf, chroot=tdir) node = TestNode(nm, config_helper=config_helper, config=tconf, pluginPaths=None) looper.add(node) nodes.append(node) looper.run(checkNodesConnected(nodes)) ensureElectionsDone(looper=looper, nodes=nodes) poolCli = poolCLI(tdir, tconf, poolCLIBaby, newPoolTxnData, newPoolTxnNodeNames, nodes) testPoolNode.poolCli = poolCli multiNodes.append(testPoolNode) tconf.NETWORK_NAME = network_bak return multiNodes
def multiPoolNodesCreated(request, tconf, looper, tdir, cliTempLogger, namesOfPools=("pool1", "pool2")): multiNodes = [] for poolName in namesOfPools: newPoolTxnNodeNames = [poolName + n for n in ("Alpha", "Beta", "Gamma", "Delta")] config_helper = ConfigHelper(tconf, chroot=tdir) ledger_dir = os.path.join(config_helper.ledger_base_dir, poolName) newPoolTxnData = getPoolTxnData(poolName, newPoolTxnNodeNames) newTdirWithPoolTxns = custom_tdir_with_pool_txns(newPoolTxnData, ledger_dir, tconf.poolTransactionsFile) newTdirWithDomainTxns = custom_tdir_with_domain_txns( newPoolTxnData, ledger_dir, domainTxnOrderedFields(), tconf.domainTransactionsFile) testPoolNode = TestMultiNode( poolName, newPoolTxnNodeNames, tdir, tconf, newPoolTxnData, newTdirWithPoolTxns, newTdirWithDomainTxns, None) poolCLIBabyGen = CliBuilder(tdir, newTdirWithPoolTxns, newTdirWithDomainTxns, looper, tconf, cliTempLogger) poolCLIBaby = next(poolCLIBabyGen(poolName)) # Ugly hack to build several networks network_bak = tconf.NETWORK_NAME tconf.NETWORK_NAME = poolName tdirWithNodeKeepInited(tdir, tconf, NodeConfigHelper, newPoolTxnData, newPoolTxnNodeNames) nodes = [] for nm in newPoolTxnNodeNames: config_helper = NodeConfigHelper(nm, tconf, chroot=tdir) node = TestNode(nm, config_helper=config_helper, config=tconf, pluginPaths=None) looper.add(node) nodes.append(node) looper.run(checkNodesConnected(nodes)) ensureElectionsDone(looper=looper, nodes=nodes) poolCli = poolCLI(tdir, tconf, poolCLIBaby, newPoolTxnData, newPoolTxnNodeNames, nodes) testPoolNode.poolCli = poolCli multiNodes.append(testPoolNode) tconf.NETWORK_NAME = network_bak return multiNodes