From cca17a665ff219af6041d0bf6544105c1839b0d5 Mon Sep 17 00:00:00 2001 From: sdk-sentinel-bot Date: Wed, 16 Sep 2026 01:14:13 +0000 Subject: [PATCH] Stabilize memo visibility test --- .../WorkflowIdSignedPayloadsTest.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/temporal-sdk/src/test/java/io/temporal/functional/serialization/WorkflowIdSignedPayloadsTest.java b/temporal-sdk/src/test/java/io/temporal/functional/serialization/WorkflowIdSignedPayloadsTest.java index 136c07bea2..8245e23bd2 100644 --- a/temporal-sdk/src/test/java/io/temporal/functional/serialization/WorkflowIdSignedPayloadsTest.java +++ b/temporal-sdk/src/test/java/io/temporal/functional/serialization/WorkflowIdSignedPayloadsTest.java @@ -1,5 +1,6 @@ package io.temporal.functional.serialization; +import static io.temporal.testUtils.Eventually.assertEventually; import static org.junit.Assert.*; import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; @@ -78,8 +79,8 @@ public void testSimpleWorkflowWithAnActivity() { assertEquals("result", workflowStub.execute("input")); } - @Test - public void testSimpleWorkflowWithMemo() throws InterruptedException { + @Test(timeout = 30_000) + public void testSimpleWorkflowWithMemo() { assumeTrue( "skipping as test server does not support list", SDKTestWorkflowRule.useExternalService); @@ -95,16 +96,20 @@ public void testSimpleWorkflowWithMemo() throws InterruptedException { String workflowId = execution.getWorkflowId(); String runId = execution.getRunId(); - // listWorkflowExecutions is Visibility API - // Temporal Visibility has latency and is not transactional with the Server API call - Thread.sleep(4_000); - List executions = - testWorkflowRule - .getWorkflowClient() - .listExecutions("WorkflowId = '" + workflowId + "' AND " + " RunId = '" + runId + "'") - .collect(Collectors.toList()); - assertEquals(1, executions.size()); + assertEventually( + Duration.ofSeconds(20), + () -> { + // Visibility is eventually consistent with workflow completion. + List visibleExecutions = + testWorkflowRule + .getWorkflowClient() + .listExecutions( + "WorkflowId = '" + workflowId + "' AND " + " RunId = '" + runId + "'") + .collect(Collectors.toList()); + assertEquals(1, visibleExecutions.size()); + return visibleExecutions; + }); assertEquals(MEMO_VALUE, executions.get(0).getMemo(MEMO_KEY, String.class)); }