|
19 | 19 | import io.temporal.internal.history.VersionMarkerUtils; |
20 | 20 | import io.temporal.internal.statemachines.WorkflowStateMachines; |
21 | 21 | import io.temporal.testing.TestWorkflowEnvironment; |
| 22 | +import io.temporal.testing.WorkflowHistoryLoader; |
22 | 23 | import io.temporal.testing.WorkflowReplayer; |
23 | 24 | import io.temporal.testing.internal.SDKTestWorkflowRule; |
24 | 25 | import io.temporal.worker.Worker; |
|
44 | 45 | public class GetVersionInterleavedUpdateReplayTest { |
45 | 46 | private static final String HISTORY_RESOURCE = |
46 | 47 | "testGetVersionInterleavedUpdateReplayHistory.json"; |
| 48 | + private static final String WAIT_FOR_MARKER_HISTORY_RESOURCE = |
| 49 | + "testGetVersionInterleavedUpdateReplayWaitForMarkerHistory.json"; |
47 | 50 | public static final String TASK_QUEUE = "get-version-interleaved-update-replay"; |
48 | 51 | private static final String EXPECTED_FIRST_CHANGE_ID = "ChangeId1"; |
49 | 52 | private static final String EXPECTED_SECOND_CHANGE_ID = "ChangeId2"; |
@@ -91,6 +94,25 @@ public void testReproducedHistoryReplays() throws Exception { |
91 | 94 | WorkflowReplayer.replayWorkflowExecution(history, GreetingWorkflowImpl.class); |
92 | 95 | } |
93 | 96 |
|
| 97 | + @Test |
| 98 | + public void testReplayHistoryWithWaitForMarkerFlagReplaysWithoutDefaultEnable() throws Exception { |
| 99 | + WorkflowExecutionHistory history = |
| 100 | + WorkflowHistoryLoader.readHistoryFromResource(WAIT_FOR_MARKER_HISTORY_RESOURCE); |
| 101 | + assertTrue( |
| 102 | + "The recorded history must advertise VERSION_WAIT_FOR_MARKER.", |
| 103 | + hasSdkFlag(history, SdkFlag.VERSION_WAIT_FOR_MARKER)); |
| 104 | + |
| 105 | + List<SdkFlag> savedInitialFlags = WorkflowStateMachines.initialFlags; |
| 106 | + List<SdkFlag> replayFlags = new ArrayList<>(savedInitialFlags); |
| 107 | + replayFlags.remove(SdkFlag.VERSION_WAIT_FOR_MARKER); |
| 108 | + WorkflowStateMachines.initialFlags = Collections.unmodifiableList(replayFlags); |
| 109 | + try { |
| 110 | + WorkflowReplayer.replayWorkflowExecution(history, GreetingWorkflowImpl.class); |
| 111 | + } finally { |
| 112 | + WorkflowStateMachines.initialFlags = savedInitialFlags; |
| 113 | + } |
| 114 | + } |
| 115 | + |
94 | 116 | public static WorkflowExecutionHistory captureReplayableHistory() { |
95 | 117 | List<SdkFlag> savedInitialFlags = WorkflowStateMachines.initialFlags; |
96 | 118 | List<SdkFlag> replayableFlags = new ArrayList<>(savedInitialFlags); |
|
0 commit comments