Daniel-Marynicz / BehatParallelExtension

Behat Parallel Extension
MIT License
18 stars 6 forks source link

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

Open jessedoj opened 2 months ago

jessedoj commented 2 months ago

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?

Daniel-Marynicz commented 2 months ago

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]
jessedoj commented 2 months ago

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?

Daniel-Marynicz commented 2 months ago

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

jessedoj commented 2 months ago

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.

Daniel-Marynicz commented 2 months ago

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

jessedoj commented 2 months ago

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

Daniel-Marynicz commented 2 months ago

You need run with command

behat --parallel-feature=2

or

behat --parallel=2
jessedoj commented 2 months ago

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.

Daniel-Marynicz commented 2 months ago

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.