hurl icon indicating copy to clipboard operation
hurl copied to clipboard

[FR] `--no-parallel` flag

Open skeggse opened this issue 8 months ago • 5 comments

Problem to solve

I'm testing AWS Lambda functions in container images, and using testcontainers and the AWS Lambda Runtime Emulator to do that.

Lambda functions are single-threaded and single-concurrency. They don't accept multiple concurrent requests, so the behavior of --test running in parallel is unhelpful in this case.

Proposal

--no-parallel to explicitly disable parallelism even if --test provided.

Alternatively, if --jobs is 0, disable parallelism that way.

skeggse avatar Apr 30 '25 00:04 skeggse

Hi @skeggse You can use --jobs 1 to disable parallel run. I'm changing the label of this issue to "documentation" because it's not clear in the doc and in the man page,

jcamiel avatar Apr 30 '25 04:04 jcamiel

Oh interesting. I'm clearly not understanding the code, then. Where does that determination happen?

https://github.com/Orange-OpenSource/hurl/blob/cfa3068a735ed20b15ebe52239e927b327b00a56/packages/hurl/src/main.rs#L84-L96

skeggse avatar Apr 30 '25 17:04 skeggse

You can see the code here https://github.com/Orange-OpenSource/hurl/blob/cfa3068a735ed20b15ebe52239e927b327b00a56/packages/hurl/src/parallel/runner.rs#L32-L45

There is a slight implementation difference between:

  • hurl *.hurl
  • hurl --test --jobs 1 *.hurl

The first one uses a sequential runner (single thread, the thread of execution is the main thread). The second one uses a parallel runner (multi-threaded), bound by only one thread (the thread of execution is the single spawned thread, not the main thread). In this case, each files is being run one after one, on this spawned thread. That's why it's more a --jobs 1 than a --no-parallel option if that makes sense. The other difference is the output (stdout and stderr). We've made the decision to always write output on the main thread. So in case of --jobs 1, logs are buffered and outputted at the end of each run. In the sequential runner, as there is only the main thread, logs are outputted immediately, non buffered.

There is also a design implementation doc here https://github.com/Orange-OpenSource/hurl/blob/master/docs/spec/runner/parallel.md

jcamiel avatar Apr 30 '25 19:04 jcamiel

Yeah, I'd specifically like a way to disable the secondary thread when using --test, since --jobs 1 has a different behavior.

skeggse avatar Jun 22 '25 19:06 skeggse

To do this, the easiest way is to not use --test: the run will be single threaded, the only thing missing is the final report (x Sucess, x Failed) etc... but you can still use various report if you need (TAP report with --report-tap, JUnit, HTML etc...). Even without ˋ--test` assertions are checked and exit code is different from 0 in presence of errors.

jcamiel avatar Jun 22 '25 20:06 jcamiel