forked from wundergraph/cosmo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.js
27 lines (23 loc) · 609 Bytes
/
bench.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import http from 'k6/http';
import { sleep, check } from 'k6';
export default function () {
let query = `
query Bench {
employees {
# resolved through employees subgraph
id
}
}`;
let headers = {
'Content-Type': 'application/json',
'GraphQL-Client-Name': 'k6',
'GraphQL-Client-Version': '0.0.1',
};
let res = http.post('http://localhost:3002/graphql', JSON.stringify({ query: query, operationName: 'Bench' }), {
headers: headers,
});
check(res, {
'is status 200': (r) => r.status === 200 && r.body.includes('errors') === false,
});
sleep(0.3);
}