async def go(ctx): client1 = genTestClient(ctx.nodeset, tmpdir=ctx.tmpdir) # remove the client's ability to sign assert client1.signer client1.signer = None assert not client1.signer ctx.looper.add(client1) await client1.ensureConnectedToNodes() operation = randomOperation() request = client1.submit(operation)[0] with pytest.raises(AssertionError): for node in ctx.nodeset: await eventually( checkLastClientReqForNode, node, request, retryWait=1, timeout=10) for n in ctx.nodeset: params = n.spylog.getLastParams(Node.reportSuspiciousClient) frm = params['clientName'] reason = params['reason'] assert frm == client1.name assert isinstance(reason, EmptySignature) params = n.spylog.getLastParams(Node.discard) reason = params["reason"] (msg, frm) = params["msg"] assert msg == request.__dict__ assert frm == client1.name assert isinstance(reason, EmptySignature)
async def go(ctx): # TODO need to make default behavior of node stack autoMode.never for n in ctx.nodeset: n.nodestack.keep.auto = AutoMode.never nodestacksVersion = {k: v.ha for k, v in ctx.nodeset.nodeReg.items()} client1 = genTestClient(nodeReg=nodestacksVersion, tmpdir=ctx.tmpdir) ctx.looper.add(client1) with pytest.raises(NotConnectedToAny): await client1.ensureConnectedToNodes()
def testGeneratedRequestSequencing(tdir_for_func): """ Request ids must be generated in an increasing order """ with TestNodeSet(count=4, tmpdir=tdir_for_func) as nodeSet: cli = genTestClient(nodeSet, tmpdir=tdir_for_func) operation = randomOperation() request = cli.createRequest(operation) assert request.reqId == 1 request = cli.createRequest(operation) assert request.reqId == 2 request = cli.createRequest(randomOperation()) assert request.reqId == 3 cli2 = genTestClient(nodeSet, tmpdir=tdir_for_func) request = cli2.createRequest(operation) assert request.reqId == 1
def client1(looper, nodeSet, tdir, up): client = genTestClient(nodeSet, tmpdir=tdir) looper.add(client) looper.run(client.ensureConnectedToNodes()) return client