Skip to content

Commit 99c4f69

Browse files
committed
Fix flaky PostponingExistingFunctionFromControlPanelSucceeds
The test postponed to new DateTime(1_000_000) - a year-0001 timestamp that is already expired - so the PostponedWatchdog could resume the function and flip its status from Postponed to Executing before the assertions ran. Postpone to a future timestamp (DateTime.UtcNow.AddDays(1)) instead, matching the sibling PostponingExistingActionFromControlPanelSucceeds test, which closes the race.
1 parent b3d30f6 commit 99c4f69

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/FunctionTests/ControlPanelTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,18 @@ protected async Task PostponingExistingFunctionFromControlPanelSucceeds(Task<IFu
174174
controlPanel.Status.ShouldBe(Status.Failed);
175175
controlPanel.FatalWorkflowException.ShouldNotBeNull();
176176

177-
await controlPanel.Postpone(new DateTime(1_000_000));
177+
var postponeUntil = DateTime.UtcNow.AddDays(1);
178+
await controlPanel.Postpone(postponeUntil);
178179

179180
await controlPanel.Refresh();
180181
controlPanel.Status.ShouldBe(Status.Postponed);
181182
controlPanel.PostponedUntil.ShouldNotBeNull();
182-
controlPanel.PostponedUntil.Value.Ticks.ShouldBe(1_000_000);
183+
controlPanel.PostponedUntil.Value.Ticks.ShouldBe(postponeUntil.Ticks);
183184

184185
var sf = await store.GetFunction(rFunc.MapToStoredId(functionId.Instance));
185186
sf.ShouldNotBeNull();
186187
sf.Status.ShouldBe(Status.Postponed);
187-
sf.Expires.ShouldBe(1_000_000);
188+
sf.Expires.ShouldBe(postponeUntil.Ticks);
188189

189190
var fwe = (FatalWorkflowException) unhandledExceptionCatcher.ThrownExceptions.Single().InnerException!;
190191
fwe.ErrorType.ShouldBe(typeof(InvalidOperationException));

0 commit comments

Comments
 (0)