How exactly does "maxDuration" work?

I’m just curious as to how the “maxDuration” option works on a scenario. There’s very little documentation on this option as far as I could find.

Our team is implementing k6 tests on our project, and the amount of k6 tests are growing frequently which causes tm’s to increase the maxDuration from 1m to 1.5m and so on… I feel this is wrong. I debated and said why don’t we remove this maxDuration field entirely as it defaults to 10 minutes and we should be fine. Let it run as long as it needs to, up to 10 minutes.

The argument back was “I think it’s a good idea for us to know if the tests are taking for example twice as long as they used to”. But, the pipeline shows how long the integration tests step shows already.

Please provide some insight on the maxDuration field and if it’s even needed in our case.

Hi @williamamcgough,

Sorry for the delay in responding.

From what you describe, and without knowing a bit more about the tests you perform, the scenarios you define and how you run them, I must admit I find it a bit hard to make any precise recommendations.

GitHub issues #1007 and #1058 give a bit more context as to why the maxDuration option was added. I was not part of the project yet when this was implemented, but my understanding is that it was introduced to disambiguate the impossibility to use both a durations and iterations option in the context of various scenario executors where it wouldn’t make sense.

What I also gather is that maxDuration was essentially introduced as an unambiguous way to limit the duration of a test using a VU-based or Iterations-based scenario executor: “run X iterations, but in the event the service is too slow, timeout after N minutes”.

Please let me know if that’s providing useful insights, and don’t hesitate to provide more details on your workflows, tests and scenarios otherwise, so we can get to the bottom of what your requirements and practices are :bowing_man: