|
| 1 | +import { sleep } from "k6"; |
| 2 | +import http from "k6/http"; |
| 3 | + |
| 4 | +export const options = { |
| 5 | + // A number specifying the number of VUs to run concurrently. |
| 6 | + vus: 10, |
| 7 | + // A string specifying the total duration of the test run. |
| 8 | + duration: "120s", |
| 9 | + |
| 10 | + // The following section contains configuration options for execution of this |
| 11 | + // test script in Grafana Cloud. |
| 12 | + // |
| 13 | + // See https://grafana.com/docs/grafana-cloud/k6/get-started/run-cloud-tests-from-the-cli/ |
| 14 | + // to learn about authoring and running k6 test scripts in Grafana k6 Cloud. |
| 15 | + // |
| 16 | + // cloud: { |
| 17 | + // // The ID of the project to which the test is assigned in the k6 Cloud UI. |
| 18 | + // // By default tests are executed in default project. |
| 19 | + // projectID: "", |
| 20 | + // // The name of the test in the k6 Cloud UI. |
| 21 | + // // Test runs with the same name will be grouped. |
| 22 | + // name: "script.js" |
| 23 | + // }, |
| 24 | + |
| 25 | + // Uncomment this section to enable the use of Browser API in your tests. |
| 26 | + // |
| 27 | + // See https://grafana.com/docs/k6/latest/using-k6-browser/running-browser-tests/ to learn more |
| 28 | + // about using Browser API in your test scripts. |
| 29 | + // |
| 30 | + // scenarios: { |
| 31 | + // // The scenario name appears in the result summary, tags, and so on. |
| 32 | + // // You can give the scenario any name, as long as each name in the script is unique. |
| 33 | + // ui: { |
| 34 | + // // Executor is a mandatory parameter for browser-based tests. |
| 35 | + // // Shared iterations in this case tells k6 to reuse VUs to execute iterations. |
| 36 | + // // |
| 37 | + // // See https://grafana.com/docs/k6/latest/using-k6/scenarios/executors/ for other executor types. |
| 38 | + // executor: 'shared-iterations', |
| 39 | + // options: { |
| 40 | + // browser: { |
| 41 | + // // This is a mandatory parameter that instructs k6 to launch and |
| 42 | + // // connect to a chromium-based browser, and use it to run UI-based |
| 43 | + // // tests. |
| 44 | + // type: 'chromium', |
| 45 | + // }, |
| 46 | + // }, |
| 47 | + // }, |
| 48 | + // } |
| 49 | +}; |
| 50 | + |
| 51 | +// The function that defines VU logic. |
| 52 | +// |
| 53 | +// See https://grafana.com/docs/k6/latest/examples/get-started-with-k6/ to learn more |
| 54 | +// about authoring k6 scripts. |
| 55 | +// |
| 56 | +export default function () { |
| 57 | + http.get("http://127.0.0.1:3003/"); |
| 58 | + sleep(0.2); |
| 59 | +} |
0 commit comments