spockframework / spockframework/spock
Flaky test or race condition - `ParallelSpec#@ResourceLock with only READ allows parallel execution of data-driven features`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I've seen the
ParallelSpec#@ResourceLock with only READ allows parallel execution of data-driven features test failing with
Condition not satisfied:
atomicInteger.get() == 3
| | |
3 1 false
at apackage.ASpec.writeA(Script_9186d4f70d72d15ebba0478d4c746046.groovy:14)
in master lately in GitHub Action run.
I tried to reproduce by adding @RepeatUntilFailure (nice addition).
First try didn't reproduce in about 1000 runs.
Second try reproced after 4 iterations with the same failure.
Third try didn't reproduce again in about 1000 runs.
So it seems there is some race condition somewhere.
To Reproduce
Add @RepeatUntilFailure to the test and try to make it fail
Expected behavior
No assertion error
Actual behavior
Occasionally assertion error
Java version
Seen with Java 8 and Java 17.
Seen with Groovy 2.5 and Groovy 3.0 variant.
Buildtool version
Gradle as configured in master
What operating system are you using
Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ParallelSpec#@ResourceLock with only READ allows parallel execution of data-driven features test and reproduce it by adding @RepeatUntilFailure, using the Gradle setup on master. Compare repeated runs on the reported Java and Groovy variants; done means the intermittent assertion failure is understood and the test no longer fails in repeated runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100