def testMultipleRequests(tdir_for_func): """ Send multiple requests to the client """ with TestNodeSet(count=7, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: for n in nodeSet: n.startKeySharing() ss0 = snapshotStats(*nodeSet) client, wal = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) ss1 = snapshotStats(*nodeSet) def x(): requests = [sendRandomRequest(wal, client) for _ in range(10)] for request in requests: looper.run( eventually(checkSufficientRepliesRecvd, client.inBox, request.reqId, 3, retryWait=1, timeout=3 * len(nodeSet))) ss2 = snapshotStats(*nodeSet) diff = statsDiff(ss2, ss1) pprint(ss2) print("----------------------------------------------") pprint(diff) profile_this(x)
def testReqExecWhenReturnedByMaster(tdir_for_func): with TestNodeSet(count=4, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: for n in nodeSet: n.startKeySharing() client1, wallet1 = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) req = sendRandomRequest(wallet1, client1) looper.run( eventually(checkSufficientRepliesRecvd, client1.inBox, req.reqId, 1, retryWait=1, timeout=15)) async def chk(): for node in nodeSet: entries = node.spylog.getAll(node.processOrdered.__name__) for entry in entries: arg = entry.params['ordered'] result = entry.result if arg.instId == node.instances.masterId: assert result else: assert result is None looper.run(eventually(chk, timeout=3))
def testReqExecWhenReturnedByMaster(tdir_for_func, tconf_for_func): with TestNodeSet(tconf_for_func, count=4, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: client1, wallet1 = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) req = sendRandomRequest(wallet1, client1) waitForSufficientRepliesForRequests(looper, client1, requests=[req]) async def chk(): for node in nodeSet: entries = node.spylog.getAll(node.processOrdered.__name__) for entry in entries: arg = entry.params['ordered'] result = entry.result if arg.instId == node.instances.masterId: assert result else: assert result is False timeout = waits.expectedOrderingTime( nodeSet.nodes['Alpha'].instances.count) looper.run(eventually(chk, timeout=timeout))
def testMultipleRequests(tdir_for_func): """ Send multiple requests to the client """ with TestNodeSet(count=7, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: for n in nodeSet: n.startKeySharing() ss0 = snapshotStats(*nodeSet) client = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) ss1 = snapshotStats(*nodeSet) def x(): requests = [sendRandomRequest(client) for _ in range(10)] for request in requests: looper.run(eventually( checkSufficientRepliesRecvd, client.inBox, request.reqId, 3, retryWait=1, timeout=3 * len(nodeSet))) ss2 = snapshotStats(*nodeSet) diff = statsDiff(ss2, ss1) pprint(ss2) print("----------------------------------------------") pprint(diff) profile_this(x)
def testReqExecWhenReturnedByMaster(tdir_for_func): with TestNodeSet(count=4, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: for n in nodeSet: n.startKeySharing() client1, wallet1 = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) req = sendRandomRequest(wallet1, client1) looper.run(eventually(checkSufficientRepliesRecvd, client1.inBox, req.reqId, 1, retryWait=1, timeout=15)) async def chk(): for node in nodeSet: entries = node.spylog.getAll( node.processOrdered.__name__) for entry in entries: arg = entry.params['ordered'] result = entry.result if arg.instId == node.instances.masterId: assert result else: assert result is None looper.run(eventually(chk, timeout=3))
def testMultipleRequests(tdir_for_func): """ Send multiple requests to the client """ with TestNodeSet(count=7, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: # for n in nodeSet: # n.startKeySharing() # TODO: ZStack does not have any mechanism to have stats, # either remove this once raet is removed or implement a `stats` # feature in ZStack if not nodeSet.UseZStack: ss0 = snapshotStats(*nodeSet) client, wal = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) if not nodeSet.UseZStack: ss1 = snapshotStats(*nodeSet) def x(): requests = [sendRandomRequest(wal, client) for _ in range(10)] for request in requests: looper.run( eventually(checkSufficientRepliesRecvd, client.inBox, request.reqId, 3, retryWait=1, timeout=3 * len(nodeSet))) if not nodeSet.UseZStack: ss2 = snapshotStats(*nodeSet) diff = statsDiff(ss2, ss1) pprint(ss2) print("----------------------------------------------") pprint(diff) profile_this(x)
def testMultipleRequests(tdir_for_func): """ Send multiple requests to the node """ with TestNodeSet(count=7, tmpdir=tdir_for_func) as nodeSet: with Looper(nodeSet) as looper: # for n in nodeSet: # n.startKeySharing() # TODO: ZStack does not have any mechanism to have stats, # either remove this once raet is removed or implement a `stats` # feature in ZStack if not config.UseZStack: ss0 = snapshotStats(*nodeSet) client, wal = setupNodesAndClient(looper, nodeSet, tmpdir=tdir_for_func) if not config.UseZStack: ss1 = snapshotStats(*nodeSet) def x(): requests = [sendRandomRequest(wal, client) for _ in range(10)] waitForSufficientRepliesForRequests(looper, client, requests=requests, fVal=3) ss2 = snapshotStats(*nodeSet) diff = statsDiff(ss2, ss1) if not config.UseZStack: ss2 = snapshotStats(*nodeSet) diff = statsDiff(ss2, ss1) pprint(ss2) print("----------------------------------------------") pprint(diff) profile_this(x)