Can’t get timeout param to work
always timeouts ar 60s
import http from 'k6/http';
export default function () {
let params = {
timeout: '12s'
};
let res = http.put('http://httpstat.us/200?sleep=1000000', params);
}
Can’t get timeout param to work
always timeouts ar 60s
import http from 'k6/http';
export default function () {
let params = {
timeout: '12s'
};
let res = http.put('http://httpstat.us/200?sleep=1000000', params);
}
Hi @adoherty
Welcome to the community forum
I tested the request with get
, and it seems to work for me, it timeout at 12s
:
import http from 'k6/http';
export default function () {
let params = {
timeout: '12s'
};
let res = http.get('http://httpstat.us/200?sleep=1000000', params);
}
I also tested with a 90s
timeout and it also works well. It stops after the 90s.
If you need to use the put( url, [body], [params] )
method, be aware you need to pass the body
, which in your case I imagine will be null
.
import http from 'k6/http';
export default function () {
let params = {
timeout: '12s'
};
let res = http.put('http://httpstat.us/200?sleep=1000000', null, params);
}
And that works as well.
I hope this helps.
Cheers!
Many thanks .
Been trying to work out differences , tried a few versions of k6
tried 2 VM’s both failed just tried my dev box and it works .
So Windows server 2016/2019 fail and windows 10 works .
??
Hi @adoherty
I believe the main difference is in the script, you need:
let res = http.put('http://httpstat.us/200?sleep=1000000', null, params);
not:
let res = http.put('http://httpstat.us/200?sleep=1000000', params);
Does the change still produce the same behavior? If you pass the params in the wrong place it is ignored, but once you pass them in the right place it should work.
I would not expect a different behavior in OS. Can you clarify the exact version and OS where it works and where it doesn’t? We would have a look to see if we can reproduce it.
NO you are absolutely right couldn’t see the wood for the trees . Tidied up my various test attempts and now all working many thanks