| 1 | // Readers open their home feed, as fast as the API answers. |
| 2 | import http from 'k6/http'; |
| 3 | |
| 4 | export { handleSummary } from './summary.js'; |
| 5 | |
| 6 | export const options = { |
| 7 | vus: Number(__ENV.VUS || 20), |
| 8 | duration: '20s', |
| 9 | summaryTrendStats: ['med', 'p(99)'], |
| 10 | }; |
| 11 | |
| 12 | // How many different users read during the test. Everybody else is offline. |
| 13 | const readers = Number(__ENV.READERS || 100000); |
| 14 | |
| 15 | export default function () { |
| 16 | const id = 1 + Math.floor(Math.random() * readers); |
| 17 | http.get(`${__ENV.BASE_URL}/feed`, { |
| 18 | headers: { Authorization: `Bearer seed-token-${id}` }, |
| 19 | }); |
| 20 | } |