temporalio / temporalio/sdk-java
Support robfig style cron defs in TestWorkflowEnvironment
Open
Nobody has claimed this yet.
enhancement
test server
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Expected Behavior
I have a cron workflow that uses the cron expression "@every 30s". This works fine when run against a temporal server, however, it fails when using the workflow unit test scaffolding.
Actual Behavior
com.xxx.runner.WorkflowTestRunnerStarterTest > run FAILED
io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid cron expression "@every 30s": Cron expression contains 2 parts but we expect one of [5]
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:244)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:225)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:142)
at io.temporal.api.workflowservice.v1.WorkflowServiceGrpc$WorkflowServiceBlockingStub.startWorkflowExecution(WorkflowServiceGrpc.java:2613)
at io.temporal.internal.external.GenericWorkflowClientExternalImpl.lambda$start$0(GenericWorkflowClientExternalImpl.java:86)
at io.temporal.internal.common.GrpcRetryer.retryWithResult(GrpcRetryer.java:127)
at io.temporal.internal.external.GenericWorkflowClientExternalImpl.start(GenericWorkflowClientExternalImpl.java:80)
at io.temporal.internal.sync.WorkflowStubImpl.startWithOptions(WorkflowStubImpl.java:155)
at io.temporal.internal.sync.WorkflowStubImpl.start(WorkflowStubImpl.java:267)
at io.temporal.internal.sync.TestWorkflowEnvironmentInternal$TimeLockingInterceptor$TimeLockingWorkflowStub.start(TestWorkflowEnvironmentInternal.java:230)
at io.temporal.internal.sync.WorkflowInvocationHandler$StartWorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:242)
at io.temporal.internal.sync.WorkflowInvocationHandler.invoke(WorkflowInvocationHandler.java:178)
at com.sun.proxy.$Proxy29.run(Unknown Source)
at io.temporal.internal.sync.WorkflowClientInternal.start(WorkflowClientInternal.java:220)
at io.temporal.client.WorkflowClient.start(WorkflowClient.java:238)
at com.xxx.runner.WorkflowTestRunnerStarter.start(WorkflowTestRunnerStarter.java:52)
at com.xxx.runner.WorkflowTestRunnerStarterTest.run(WorkflowTestRunnerStarterTest.java:50)```
## Specifications
- Version: temporal java client 0.27.0
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
Reproduce the failure with the TestWorkflowEnvironment and the cron expression "@every 30s". Start at TestWorkflowEnvironmentInternal and the workflow-start path shown in the stack trace, then compare its cron handling with the server behavior. Done means the test environment accepts this robfig-style definition without the invalid-expression error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100