BehatParallelExtension icon indicating copy to clipboard operation
BehatParallelExtension copied to clipboard

Environment variable array count does not seem to limit amount of workers?

Open jessedoj opened this issue 1 year ago • 9 comments

Thank you very much for making this project! I'm trying to get this to work with a Drupal site. I can't just execute it with max workers as there are a lot of collisions on features and then MySQL just goes away at some point and it all dies.

So, I am trying to now just test with 2 workers, and give each their own database. My behat.yml looks like so:

Screenshot 2024-05-29 at 9 29 32 AM

I also in settings.php for Drupal use the environment variable that is set above to give each thread it's own database:

Screenshot 2024-05-29 at 9 30 36 AM

Now, whenever I kick off Behat with parallel feature, I get the following output (starts with 8 workers)

Screenshot 2024-05-29 at 9 32 14 AM

What am I doing wrong here?

jessedoj avatar May 29 '24 16:05 jessedoj

When you run behat --help. then You have listed command options

  -l, --parallel[=PARALLEL]                  How many scenario jobs run in parallel? Available values empty or integer [default: false]
      --parallel-feature[=PARALLEL-FEATURE]  How many scenario jobs run in parallel feature mode? Available values empty or integer [default: false]
```

Daniel-Marynicz avatar May 29 '24 19:05 Daniel-Marynicz

So, is the readme wrong then that the amount of workers you get is not relative to the count of the array in behat.yml?

If I use --parallel-feature[2] will each respective parallel worker get the environment variable?

jessedoj avatar May 29 '24 19:05 jessedoj

And this is also described in README.md https://github.com/Daniel-Marynicz/BehatParallelExtension?tab=readme-ov-file#usage

Daniel-Marynicz avatar May 29 '24 19:05 Daniel-Marynicz

Ah, I think I see the issue. You explain how to set the amount of workers after you explain how to limit the number in the readme.

Maybe put that info right at the top? Seems immediately pertinent.

jessedoj avatar May 29 '24 20:05 jessedoj

Environment array only defines the number of workers you can run. But you must set the number of workers on the command line.

Daniel-Marynicz avatar May 29 '24 20:05 Daniel-Marynicz

Interesting, so you can set the environment array to 2, but run the command and it'll run max even if only 2?

jessedoj avatar May 29 '24 20:05 jessedoj

You need run with command

behat --parallel-feature=2

or

behat --parallel=2

Daniel-Marynicz avatar May 29 '24 20:05 Daniel-Marynicz

Okay, so the readme is wrong when it says "From this environments array depends on how much maximum you can run Workers."

The readme probably needs a good workthrough. I can try and update it once I get this all working.

jessedoj avatar May 29 '24 20:05 jessedoj

It is not wrong. The readme does not say that there will be as many threads depending on the number of keys in the array. It depends on what the user specifies in the command line.

You can update the readme and do a pull request.

Daniel-Marynicz avatar May 30 '24 07:05 Daniel-Marynicz