Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

TestWorkflowEnvironment sleep incorrect behaviour

未关闭
#2,642 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java
领域
testing

调研方向

Start by reproducing the issue with TestWorkflowEnvironment.sleep(Duration.ofDays(1)) in isolation and after the child-workflow test shown in the report. Inspect the TestWorkflowEnvironment lifecycle and child-workflow execution path to identify what changes virtual-time behavior. Done means the sleep advances instantly in the full integration suite as well as when run alone.

由索引模型根据 Issue 内容生成。

描述

test server

Expected Behavior

Integration tests with Temporal should not actually sleep or wait when using TestWorkflowEnvironment.sleep().
The virtual time should advance instantly, regardless of other tests being executed before.

Actual Behavior

In some cases, tests sleep and wait in real time instead of using virtual time.
This happens when a test using TestWorkflowEnvironment.sleep() runs after another test that executed a child workflow.

Steps to Reproduce the Problem

  1. Use Temporal library 1.30.1 with io.temporal:temporal-spring-boot-starter.

  2. Have a workflow with setStartDelay().

  3. Write an integration test that relies on TestWorkflowEnvironment.sleep(Duration.ofDays(1)).

    When run in isolation, the test passes instantly (virtual time works).

  4. Add another test that uses a child workflow, e.g.:

TestWorkflow transferWorkflow =
    Workflow.newChildWorkflowStub(
        TestWorkflow.class,
        ChildWorkflowOptions.newBuilder()
            .setWorkflowId("test-id")
            .setTaskQueue("test-task-queues")
            .setParentClosePolicy(ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON)
            .setWorkflowIdReusePolicy(WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE)
            .setRetryOptions(RetryOptions.newBuilder()
                .setMaximumAttempts(MAXIMUM_ATTEMPTS)
                .build())
            .build()
    );


Async.procedure(() -> transferWorkflow.test(test.testId()));

Promise<WorkflowExecution> childExecution = Workflow.getWorkflowExecution(transferWorkflow);
childExecution.get();
  1. Run the whole test suite.

The test with sleep(Duration.ofDays(1)) now sleeps in real time instead of advancing virtual time.

Notes

Behavior is consistent:

✅ Works when the test with sleep is executed alone.

❌ Breaks when a test with a child workflow ran before it.

Looks like something in the child workflow test "switches" the TestWorkflowEnvironment from virtual time to real time.

Specifications

Version: 1.30.1

Platform: Java

Dependency: io.temporal:temporal-spring-boot-starter

主要语言
Java
星标
434
派生
252
平均合并
3 天 15 分钟
30 天内合并 PR
13

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

temporalio/sdk-java 的其他 Issue

查看 temporalio/sdk-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。