Exemplo n.º 1
0
def testMultipleClients(looper, txnPoolNodeSet, steward1, stewardWallet,
                        tdirWithPoolTxns):
    n = txnPoolNodeSet[0]
    n.nodestack.ctx.set(zmq.MAX_SOCKETS, 4096)
    clientNum = 100
    pr = psutil.Process(os.getpid())
    print('Len connections before starting {}'.format(len(pr.connections())))
    for i in range(clientNum):
        name = randomString()
        wallet = addNewClient(None, looper, steward1, stewardWallet, name)

        def chk():
            for node in txnPoolNodeSet:
                assert wallet.defaultId in node.clientAuthNr.clients

        looper.run(eventually(chk, retryWait=1, timeout=5))
        newSteward = TestClient(name=name,
                                nodeReg=None,
                                ha=genHa(),
                                basedirpath=tdirWithPoolTxns)

        looper.add(newSteward)
        looper.run(newSteward.ensureConnectedToNodes())
        print('Connected {}'.format(i))
        print('Len connections {}'.format(len(pr.connections())))
Exemplo n.º 2
0
def ensureClientConnectedToNodesAndPoolLedgerSame(looper, client: TestClient,
                                                  *nodes: Iterable[TestNode]):
    looper.run(
        eventually(checkClientPoolLedgerSameAsNodes,
                   client,
                   *nodes,
                   retryWait=1,
                   timeout=3 * len(nodes)))
    looper.run(client.ensureConnectedToNodes())
Exemplo n.º 3
0
def ensureClientConnectedToNodesAndPoolLedgerSame(looper, client: TestClient,
                                                  *nodes: TestNode):
    looper.run(client.ensureConnectedToNodes())
    timeout = waits.expectedPoolGetReadyTimeout(len(nodes))
    looper.run(
        eventually(checkClientPoolLedgerSameAsNodes,
                   client,
                   *nodes,
                   retryWait=.5,
                   timeout=timeout))
Exemplo n.º 4
0
def addNewStewardAndNode(looper, creatorClient, creatorWallet, stewardName,
                         newNodeName, tdir, tconf,
                         allPluginsPath=None, autoStart=True):
    newStewardWallet = addNewClient(STEWARD, looper, creatorClient,
                                    creatorWallet, stewardName)
    newSteward = TestClient(name=stewardName,
                            nodeReg=None, ha=genHa(),
                            # DEPR
                            # signer=newStewardSigner,
                            basedirpath=tdir)

    looper.add(newSteward)
    looper.run(newSteward.ensureConnectedToNodes())
    newNode = addNewNode(looper, newSteward, newStewardWallet, newNodeName,
                         tdir, tconf, allPluginsPath, autoStart=autoStart)
    return newSteward, newStewardWallet, newNode
Exemplo n.º 5
0
def ensureNewNodeConnectedClient(looper, client: TestClient, node: TestNode):
    stackParams = node.clientStackParams
    client.nodeReg[stackParams['name']] = HA('127.0.0.1', stackParams['ha'][1])
    looper.run(client.ensureConnectedToNodes())
Exemplo n.º 6
0
def ensureClientConnectedToNodesAndPoolLedgerSame(looper, client: TestClient,
                                                  *nodes:Iterable[TestNode]):
    looper.run(eventually(checkClientPoolLedgerSameAsNodes, client,
                          *nodes, retryWait=1,
                          timeout=3*len(nodes)))
    looper.run(client.ensureConnectedToNodes())
Exemplo n.º 7
0
def ensureNewNodeConnectedClient(looper, client: TestClient, node: TestNode):
    stackParams = node.clientStackParams
    client.nodeReg[stackParams['name']] = HA('127.0.0.1', stackParams['ha'][1])
    looper.run(client.ensureConnectedToNodes())