eeverman / eeverman/andhow

JUnit extensions need to deal w/ concurrent tests

Open
#747 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
25
Forks
34
PR merge metrics
No merged PRs in 30d

Description

AndHow's JUnit extensions currently ignore the possible issues with concurrent tests. Since AndHow is a singleton model, it will cause problems if its state changes due to the KillAndHowXXX extensions. Similarly, the system prop and jndi extensions can cause similar issues.

JUnit has a [mechanism to mark tests to lock resources](https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution-synchronization) for read or write. This should be used, though it is new in JUnit 5.3 (seems a reasonable version expectation).

Additionally, this should be documented better, perhaps a whole section of documentation on parallel testing.

AndHow will be in an unconfigured state prior to the first access, and since test order is unknown, the state of tests is technically different each time. It might be good to force AndHow to initialize somehow... Maybe a separate auto-detect API to force initialization similar to auto-configuration??

Its hard to know what tests will use AndHow because it is, by design, deep into classes. Thus, nearly all tests require a marker of `@ResourceLock(value = ANDHOW_KEY , mode = READ)`. Any test that modifies AndHow state in any way should have a `READ_WRITE` mode marked.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.