运行带有多个vuser的k6脚本失败,"请求被取消(等待标题时超出了Client.Timeout)"错误

时间:2017-07-29 06:02:10

标签: performance-testing load-testing k6

我的以下k6脚本可以正常使用1个vuser。但是每当我使用超过1个vuser运行时,脚本都会失败: -

  

(←[33mWARN←[0m [0114]请求失败←[33merror←[0m ="发布http://myurl.mycompany.com/v1/Order:net / http:请求已取消(在等待标题时超出了Client.Timeout)&# 34)。

见下面的脚本。任何帮助将不胜感激。

// Auto-generated by the Load Impact converter

import http from "k6/http";
import { check, group, sleep} from "k6";

export let options = {
  vus: 2,
  duration: "120s",
//  maxRedirects: 4
}

export default function() {
    let res;
    res = http.post("http://myurl.mycompany.com.com/v1/Order",
      "{    \"orderNumber\": \"\",  \"webConfirmationId\": 12345,   \"opptunityNum\": \"201707-861215\",    \"accountNumber\": \"GNUF4240\",    \"CustomerInstructions\": \"\", \"internalComments\": [     {           \"text\": \"Client Contact: John D johnd@mycompany.com 2125555555 \"        }   ],  \"OrderContact\": \"\", \"SalesForceContactId\": \"\",  \"ancillaryItems\": [       {           \"ancillaryItemTypeCode\": \"DISCOUNT\",            \"description\": \"2% Web Discount\",           \"unitPrice\": -4.99,           \"quantity\": 1.0       }   ],  \"billToAddress\": {},  \"CampaignNumber\": \"ZXYCR\",  \"ChargeLogicReferenceNumber\": \"\",   \"createDate\": \"2017-07-26T20:19:54.587Z\",   \"CON\": \"\",  \"orderTypeCode\": \"4XD\"  }",
      { headers: { "Authorization" : "bearer jahhHodoUVVTKqhsypd_tWbcsk", "Content-Type" : "application/json" } });
    check(res, {
      "is status 200":(r)=>r.status===200
    });
    sleep(3);
}

1 个答案:

答案 0 :(得分:0)

由于它是POST请求,因此响应代码应为201,因为它是创建动作,