cucumber / godog

Cucumber for golang
MIT License
2.21k stars 249 forks source link

Setting option `Concurrency = 2` fails when running the Example #572

Closed seanw2020 closed 9 months ago

seanw2020 commented 9 months ago

👓 What did you see?

Sometimes, I see this

--- FAIL: TestFeatures (0.00s)
    --- FAIL: TestFeatures/Eat_5_out_of_12 (0.00s)
        suite.go:527: you cannot eat 5 godogs, there are 0 available
    godogs_test.go:48: zero status code expected, 1 received

Sometimes, I see PASS.

✅ What did you expect to see?

PASS (every time)

📦 Which tool/library version are you using?

go version go1.19.2 linux/amd64 github.com/cucumber/godog v0.12.6

🔬 How could we reproduce it?

  1. clone this repo (https://github.com/cucumber/godog)
  2. cd _examples/godogs/
  3. open godogs_test.go
  4. in TestFeatures function, add o.Concurrency = 2
  5. run go test

📚 Any additional context?

I'm new to godog, so this may be working "as expected," but I couldn't find an example of using concurrency properly here.

vearutop commented 9 months ago

Good point, indeed concurrency needs proper support from step definitions to avoid race conditions. I think it makes sense to update the example to be compatible with concurrent runner.