-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Introduce global default lock to facilitate isolated test execution #2382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit introduces a new global resource lock "__global__" that all test descriptors that are children of the engine descriptor acquire by default in READ mode. Using the `@Isolated` annotation in the Jupiter API causes the mode to be changed to READ_WRITE. Co-authored-by: Leonard Brünings <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #2382 +/- ##
=========================================
Coverage 89.84% 89.84%
- Complexity 4533 4542 +9
=========================================
Files 397 397
Lines 11211 11233 +22
Branches 909 908 -1
=========================================
+ Hits 10072 10092 +20
- Misses 863 864 +1
- Partials 276 277 +1
Continue to review full report at Codecov.
|
...form-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java
Outdated
Show resolved
Hide resolved
...orm-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java
Outdated
Show resolved
Hide resolved
junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java
Outdated
Show resolved
Hide resolved
junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java
Outdated
Show resolved
Hide resolved
...form-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java
Outdated
Show resolved
Hide resolved
...m-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java
Show resolved
Hide resolved
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target(ElementType.TYPE) | ||
| @Inherited | ||
| @ResourceLock("org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if the constant could be declared in the interface, so it could be referenced from ExclusiveResource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jupiter-api doesn't have a dependency on platform-engine or vice versa.
This commit introduces a new global resource lock "global" that all
test descriptors that are children of the engine descriptor acquire by
default in READ mode. Using the
@Isolatedannotation in the JupiterAPI causes the mode to be changed to READ_WRITE.
Will eventually resolve #2142.
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@Isolatedon test classes and in@Nestedtests@APIannotations