Skip to content

Commit 6b33906

Browse files
committed
Fix evict-on-finish change
1 parent a2e1f34 commit 6b33906

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/Temporalio.Tests/Worker/WorkflowWorkerTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ await ExecuteWorkerAsync<MiscHelpersWorkflow>(
12271227
// Now query after close to check that is replaying worked
12281228
var isReplayingValues = await Env.Client.GetWorkflowHandle<MiscHelpersWorkflow>(
12291229
workflowId).QueryAsync(wf => wf.GetEventsForIsReplaying());
1230-
Assert.Equal(new[] { false, true }, isReplayingValues);
1230+
Assert.Equal(new[] { false, true, true }, isReplayingValues);
12311231
},
12321232
new(taskQueue: taskQueue));
12331233
}
@@ -2997,9 +2997,10 @@ await ExecuteWorkerAsync<DynamicWorkflow>(
29972997
await handle.SignalAsync(wf => wf.SomeSignalAsync("signal arg"));
29982998
Assert.Equal("done", await handle.QueryAsync(wf => wf.SomeQuery("query arg")));
29992999
Assert.Equal("done", await handle.ExecuteUpdateAsync(wf => wf.SomeUpdateAsync("update arg")));
3000-
await handle.SignalAsync(wf => wf.FinishAsync());
3001-
Assert.Equal("done", await handle.GetResultAsync());
3002-
Assert.Equal(
3000+
// Event list must be collected before the WF finishes, since when it finishes it
3001+
// will be evicted from the cache and the first SomeQuery event will not exist upon
3002+
// replay.
3003+
await AssertMore.EqualEventuallyAsync(
30033004
new List<string>
30043005
{
30053006
"activity-NonDynamicActivity: activity arg",
@@ -3008,7 +3009,9 @@ await ExecuteWorkerAsync<DynamicWorkflow>(
30083009
"update-SomeUpdate: update arg",
30093010
"workflow-NonDynamicWorkflow: workflow arg",
30103011
},
3011-
(await handle.QueryAsync(wf => wf.Events)).OrderBy(v => v).ToList());
3012+
async () => (await handle.QueryAsync(wf => wf.Events)).OrderBy(v => v).ToList());
3013+
await handle.SignalAsync(wf => wf.FinishAsync());
3014+
Assert.Equal("done", await handle.GetResultAsync());
30123015
},
30133016
new TemporalWorkerOptions().AddActivity(DynamicWorkflow.DynamicActivity));
30143017
}
@@ -6042,4 +6045,4 @@ private async Task<TResult> ExecuteWorkerAsync<TWorkflow, TResult>(
60426045
using var worker = new TemporalWorker(client ?? Client, options);
60436046
return await worker.ExecuteAsync(() => action(worker));
60446047
}
6045-
}
6048+
}

0 commit comments

Comments
 (0)