Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

TestWorkflowEnvironment sleep incorrect behaviour

Đang mở
#2,642 1 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
434
Fork
252
Merge trung bình
3 ngày 15 phút
Pull request đã merge (30 ngày)
13

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của temporalio/sdk-java

Tất cả issue của temporalio/sdk-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.