Skip to content

JUnit extensions need to deal w/ concurrent tests #747

@eeverman

Description

@eeverman

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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions