0

I have a rather complicated setup which forces me to pass --duration and --vus to k6 CLI.

It ends up looking like

k6 run --vus 200 --duration 60s fixed-scenarios.js

Because of this my custom scenarios are being overridden by a default scenario.

Is there a way to prevent it from within the script?

LEQADA
  • 1,913
  • 3
  • 22
  • 41

1 Answers1

0

In k6 order of presence cli flags will override everything else.

import http from "k6/http";

const options = {
  foo_scenario: {
    executor: "shared-iterations",
    vus: 1,
    iterations: 1,
    maxDuration: "10s",
  },
};

export default function () {
  http.get("https://stackoverflow.com");
}
  • If you only run with k6 run script.js it will make one request.
  • If you override with cli flags, like k6 run script.js --vus 10 --iterations 10 it'll make 10 ten requests.
Umut Gerçek
  • 630
  • 6
  • 9
  • So, basically there is no way to override it from the script. Was hoping for an undocumented trick. – LEQADA Sep 07 '22 at 10:59