Неверный URL GoError: недопустимое значение URL в K6 Performance Testing
Я запускаю API через K6 http.url и получаю следующее исключение. Не уверен, что упускается в URL?
export default function() {
let url = http.get("http://test.loadimpact.com");
let res = http.get(url);
check(res, {
"status was 200": (r) => r.status == 200,
"transaction time OK": (r) => r.timings.duration < 200
});
sleep(1);
}
WARN[0063] Request Failed error="Get http://test.loadimpact.com: dial tcp "ip":80: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."
ERRO[0063] GoError: invalid URL value '&http.Response{ctx:(*context.valueCtx)(0xc003dfbb00), RemoteIP:"", RemotePort:0, URL:"http://test.loadimpact.com", Status:0, Proto:"", Headers:map[string]string(nil), Cookies:map[string][]*httpext.HTTPCookie(nil), Body:interface {}(nil), Timings:httpext.ResponseTimings{Duration:0, Blocked:0, LookingUp:0, Connecting:0, TLSHandshaking:0, Sending:0, Waiting:0, Receiving:0}, TLSVersion:"", TLSCipherSuite:"", OCSP:netext.OCSP{ProducedAt:0, ThisUpdate:0, NextUpdate:0, RevokedAt:0, RevocationReason:"", Status:""}, Error:"dial tcp "ip":80: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.", ErrorCode:1210, Request:httpext.Request{Method:"GET", URL:"http://test.loadimpact.com", Headers:map[string][]string{"User-Agent":[]string{"k6/0.24.0 (https://k6.io/)"}}, Body:"", Cookies:map[string][]*httpext.HTTPRequestCookie{}}, cachedJSON:interface {}(nil), validatedJSON:false}'
1 ответ
Вы устанавливаете URL, чтобы быть результатом http.get
вызов функции, я думаю, вы намеревались сделать:
export default function() {
let url = "http://test.loadimpact.com";
let res = http.get(url);
check(res, {
"status was 200": (r) => r.status == 200,
"transaction time OK": (r) => r.timings.duration < 200
});
sleep(1);
}