Beispiel #1
0
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 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 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)
Beispiel #4
0
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)