Skip to content

Difference between @Isolated and @ResourceLock? #2125

Answered by Vampire
efenderbosch-atg asked this question in Q&A
Discussion options

You must be logged in to vote

Hard to say without knowing your project. But I guess your problem is, that you get a read-write lock (the default) for all tests that try to get the logs, but you still run other test in parallel that produce (and so pollute) log messages. So to get it correct with @ResourceLock, you probably need to get a read lock on all tests that write log messages and a read-write lock where you actually test the log messages, even if semantics of naming are a bit orthogonal in this specific case.

By using @Isolated it runs without any other test running, so no other test can interfere. You can imagine it as getting a read-write lock for a resource all other tests have a read-lock on.

Alternatively,…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@efenderbosch-atg
Comment options

Answer selected by efenderbosch-atg
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants