Per-vu-iterations - send vus from cli

I am trying to use the per-vu-iterations in a scenario where i want all vus to run an exact number of iterations.

export const options = {  
scenarios: {
    completeconfirm: {
        executor: 'per-vu-iterations',   
        maxDuration: '30m',
    }
  }
};

qn 1: is it possible to send in value of vus and iterations from cli for this scenario ?
k6 run -i 10 -u 2 /test.js

qn 2: is this a typo here for the cli options - mentioning number of vus?
docs has -v instead of -u

Hi @jeevananthank

  1. There is no cli option but you can use -e to set an enveronment variable and use that
    k6 run -e vus=20 script.js
export const options = {  
scenarios: {
    completeconfirm: {
        executor: 'per-vu-iterations',   
        maxDuration: '30m',
        vus: parseInt(__ENV.vus),
    }
  }
};

I highly recommend if you do this to add some logic for checking if this is set and so on :wink: Also vus is probably not a great name it should probably be a bit more descriptive

  1. it’s a typo
2 Likes