Пример #1
0
def push():
    ts = current_millis()
    token_nodeId = helper.nodeId
    token_securityToken = grinder.properties.getProperty(
        'server.auth.token', 'test')

    result = httpRequest.HEAD(serverPath + '/push' + '?nodeId=' +
                              token_nodeId + '&securityToken=' +
                              token_securityToken)

    if result.statusCode == 200:
        result = httpRequest.PUT(
            serverPath + '/push' + '?nodeId=' + token_nodeId +
            '&securityToken=' + token_securityToken,
            helper.generateBatchPayload())

        resultString = String(String(result.data).toUpperCase())

        if result.statusCode != 200 or resultString.contains(
                '=ER') or resultString.contains('=SK'):
            log.warn(
                "Failed to push.  The status code was %d and the response string was %s"
                % (result.statusCode, resultString))
            grinder.statistics.forCurrentTest.success = 0
        else:
            grinder.statistics.forCurrentTest.addLong("userLong1", 1)
            grinder.statistics.forCurrentTest.addDouble(
                "userDouble0", (current_millis() - ts) / 1000.0)
    elif result.statusCode == 670:
        grinder.statistics.forCurrentTest.addLong("userLong0", 1)
    else:
        grinder.statistics.forCurrentTest.success = 0

    return result
Пример #2
0
def push():      
    token_nodeId = helper.nodeId
    token_securityToken = grinder.properties.getProperty('server.auth.token', 'test')      

    result = httpRequest.HEAD(serverPath + '/push' +
      '?nodeId=' +
      token_nodeId +
      '&securityToken=' +
      token_securityToken)
      
    if result.statusCode == 200:
        result = httpRequest.PUT(serverPath + '/push' + '?nodeId=' + token_nodeId +
                                '&securityToken=' + token_securityToken,
         helper.generateBatchPayload())
        
        resultString = String(String(result.data).toUpperCase())
        
        if result.statusCode != 200 or resultString.contains('=ER') or resultString.contains('=SK'):
            log.warn("Failed to push.  The status code was %d and the response string was %s" % (result.statusCode, resultString))
            grinder.statistics.forCurrentTest.success = 0        
    else:
        grinder.statistics.forCurrentTest.success = 0 

    return result