github-api icon indicating copy to clipboard operation
github-api copied to clipboard

Ban use of `Thread.sleep()` in tests unless specifically approved

Open bitwiseman opened this issue 1 year ago • 0 comments

We add await-based pauses the don't slow down CI testing:

https://github.com/hub4j/github-api/blob/main/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java#L574-L584

There are some timing based tests, but they are the exception. Most tests don't need to care.
We need to make await() an easily used test helper, enforce not calling Thread.sleep() unless specifically approved, and provide a helpful failure message regarding using await.

Perhaps also a sleepWhenTakingSnapshot() method. See #1810 for example of why.

bitwiseman avatar Mar 11 '24 21:03 bitwiseman