Skip to content

Instantly share code, notes, and snippets.

@leandroandrade
Created December 19, 2023 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandroandrade/5ce6c1d32d46a260d4446a466d6bc465 to your computer and use it in GitHub Desktop.
Save leandroandrade/5ce6c1d32d46a260d4446a466d6bc465 to your computer and use it in GitHub Desktop.
// k6 run sample-k6-getpost.js
import http from 'k6/http';
import {sleep} from 'k6';
export let options = {
insecureSkipTLSVerify: true,
noConnectionReuse: false,
stages: [
{ duration: '1m', target: 10 },
{ duration: '2m', target: 20 },
{ duration: '1m', target: 0 },
]
}
export default function () {
const params = {
headers: {
'Content-Type': 'application/json',
},
};
const payload = JSON.stringify({
name: `User ${Math.random()}`,
email: `email${Math.random()}@exemplo.com`,
password: `password${Math.random()}`,
});
http.batch([
['POST', 'http://localhost:8080/', payload, params],
['GET', `http://localhost:8080/${Math.random()}`]
]);
sleep(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment