Skip to content

Commit

Permalink
Fix evict-on-finish change
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource committed Dec 4, 2024
1 parent a2e1f34 commit 6b33906
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/Temporalio.Tests/Worker/WorkflowWorkerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ await ExecuteWorkerAsync<MiscHelpersWorkflow>(
// Now query after close to check that is replaying worked
var isReplayingValues = await Env.Client.GetWorkflowHandle<MiscHelpersWorkflow>(
workflowId).QueryAsync(wf => wf.GetEventsForIsReplaying());
Assert.Equal(new[] { false, true }, isReplayingValues);
Assert.Equal(new[] { false, true, true }, isReplayingValues);
},
new(taskQueue: taskQueue));
}
Expand Down Expand Up @@ -2997,9 +2997,10 @@ await ExecuteWorkerAsync<DynamicWorkflow>(
await handle.SignalAsync(wf => wf.SomeSignalAsync("signal arg"));
Assert.Equal("done", await handle.QueryAsync(wf => wf.SomeQuery("query arg")));
Assert.Equal("done", await handle.ExecuteUpdateAsync(wf => wf.SomeUpdateAsync("update arg")));
await handle.SignalAsync(wf => wf.FinishAsync());
Assert.Equal("done", await handle.GetResultAsync());
Assert.Equal(
// Event list must be collected before the WF finishes, since when it finishes it
// will be evicted from the cache and the first SomeQuery event will not exist upon
// replay.
await AssertMore.EqualEventuallyAsync(
new List<string>
{
"activity-NonDynamicActivity: activity arg",
Expand All @@ -3008,7 +3009,9 @@ await ExecuteWorkerAsync<DynamicWorkflow>(
"update-SomeUpdate: update arg",
"workflow-NonDynamicWorkflow: workflow arg",
},
(await handle.QueryAsync(wf => wf.Events)).OrderBy(v => v).ToList());
async () => (await handle.QueryAsync(wf => wf.Events)).OrderBy(v => v).ToList());
await handle.SignalAsync(wf => wf.FinishAsync());
Assert.Equal("done", await handle.GetResultAsync());
},
new TemporalWorkerOptions().AddActivity(DynamicWorkflow.DynamicActivity));
}
Expand Down Expand Up @@ -6042,4 +6045,4 @@ private async Task<TResult> ExecuteWorkerAsync<TWorkflow, TResult>(
using var worker = new TemporalWorker(client ?? Client, options);
return await worker.ExecuteAsync(() => action(worker));
}
}
}

0 comments on commit 6b33906

Please sign in to comment.