temporalio / temporalio/sdk-java
Support assertions in `TestWorkflowEnvironment.registerDelayedCallback`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Is your feature request related to a problem? Please describe.
When assertions fail in TestWorkflowEnvironment.registerDelayedCallback, the errors in the callback are swallowed. This is counterintuitive.
For instance, I expect the following test to fail.
class MyTest {
private val testEnv: TestWorkflowEnvironment
@Test
fun thisShouldFail() {
testEnv.registerDelayedCallback(Duration.ofSeconds(1)) {
assertThat(false).isTrue()
}
testEnv.sleep(Duration.ofSeconds(10))
}
}
But it succeeds with an error log.
10:35:11.197 [Timer task] ERROR i.t.i.t.SelfAdvancingTimerImpl - Unexpected failure in timer callback
org.opentest4j.AssertionFailedError:
Expecting value to be true but was false
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Describe the solution you'd like
Propagate the error to the test method.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating TestWorkflowEnvironment.registerDelayedCallback and the timer callback handling it. Reproduce the Kotlin example, then trace how callback failures are reported; done means an assertion failure in the delayed callback causes the test method to fail rather than only producing an error log.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100