You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ResourceLock is great for ensuring tests run with as much concurrency as possible while protecting exclusive access to resources for the duration of a single test method/class.
My issue is that it only protects the resource within that single JUnit test run. If I execute a number of different test runs simultaneously (in different processes) and those test runs have tests that use @ResourceLock("foo") then foo can be accessed at the same time from the different test runs.
This happens for me as I use Gradle and have many subprojects. Gradle allows running subprojects tests in parallel or sequentially. Running tests in parallel means each project will run its tests in its own process and so @ResourceLock("foo") will not be respected across subprojects.
Because of this I have to run each subproject's test task sequentially which is slower.
Deliverables
Ideally there would be an option on @ResourceLock to specify the level of the lock e.g. @ResourceLock(level = LOCAL | MACHINE).
For @ResourceLock("Foo", level = LOCAL), the locking would behave as it currently is and this would be the default.
For @ResourceLock("Foo", level = MACHINE) the lock on Foo would prevent any junit runs on that machine from simultaneously accessing Foo. (Perhaps using java.nio.channels.FileLock)
It would be good if this could be extended to @Isolated(level = LOCAL | MACHINE) to allow only a single test to run concurrently even during multiple simultaneous test runs.
Or is there already a way to do this?
The text was updated successfully, but these errors were encountered:
@ResourceLock
is great for ensuring tests run with as much concurrency as possible while protecting exclusive access to resources for the duration of a single test method/class.My issue is that it only protects the resource within that single JUnit test run. If I execute a number of different test runs simultaneously (in different processes) and those test runs have tests that use
@ResourceLock("foo")
thenfoo
can be accessed at the same time from the different test runs.This happens for me as I use Gradle and have many subprojects. Gradle allows running subprojects tests in parallel or sequentially. Running tests in parallel means each project will run its tests in its own process and so
@ResourceLock("foo")
will not be respected across subprojects.Because of this I have to run each subproject's test task sequentially which is slower.
Deliverables
Ideally there would be an option on
@ResourceLock
to specify the level of the lock e.g.@ResourceLock(level = LOCAL | MACHINE)
.For
@ResourceLock("Foo", level = LOCAL)
, the locking would behave as it currently is and this would be the default.For
@ResourceLock("Foo", level = MACHINE)
the lock onFoo
would prevent any junit runs on that machine from simultaneously accessingFoo
. (Perhaps usingjava.nio.channels.FileLock
)It would be good if this could be extended to
@Isolated(level = LOCAL | MACHINE)
to allow only a single test to run concurrently even during multiple simultaneous test runs.Or is there already a way to do this?
The text was updated successfully, but these errors were encountered: