Skip to content

Commit

Permalink
dbg
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed Jan 25, 2025
1 parent 6aa669f commit c441361
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
timeout-minutes: 10

strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest ]

Expand Down
52 changes: 48 additions & 4 deletions tests/NCronJob.Tests/NCronJobIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ public async Task WhileAwaitingJobTriggeringInstantJobShouldAnywayTriggerCronJob

await provider.GetRequiredService<IHostedService>().StartAsync(CancellationToken);

// Added here not in the source code:
// To enable processing time
await Task.Delay(100, CancellationToken);
FakeTimer.Advance(TimeSpan.FromMilliseconds(100));
//// Added here not in the source code:
//// To enable processing time
//await Task.Delay(100, CancellationToken);
//FakeTimer.Advance(TimeSpan.FromMilliseconds(100));

Guid instantOrchestrationId = provider.GetRequiredService<IInstantJobRegistry>().RunInstantJob<SimpleJob>(token: CancellationToken);

Expand Down Expand Up @@ -322,6 +322,50 @@ public async Task WhileAwaitingJobTriggeringInstantJobShouldAnywayTriggerCronJob
Assert.Equal(ExecutionState.OrchestrationCompleted, instantOrchestrationEvents[6].State);
Assert.Equal(7, instantOrchestrationEvents.Count);

/*
24.04 arm
s 0 2000-01-01T00:00:00.0000000+00:00
i 0 2000-01-01T00:00:01.0000000+00:00
s 3 2000-01-01T00:00:01.0000000+00:00
i 2 2000-01-01T00:00:01.0000000+00:00 <-----
s 4 2000-01-01T00:00:01.0000000+00:00
i 6 2000-01-01T00:00:01.1924400+00:00
24.04
s 0 2000-01-01T00:00:00.0000000+00:00
i 0 2000-01-01T00:00:01.0000000+00:00
s 3 2000-01-01T00:00:01.0000000+00:00
i 2 2000-01-01T00:00:01.0602800+00:00
s 4 2000-01-01T00:00:01.0000000+00:00
i 6 2000-01-01T00:00:01.1467200+00:00
win
s 0 2000-01-01T00:00:00.0000000+00:00
i 0 2000-01-01T00:00:01.0000000+00:00
s 3 2000-01-01T00:00:01.0000000+00:00
i 2 2000-01-01T00:00:01.0093100+00:00
s 4 2000-01-01T00:00:01.0000000+00:00
i 6 2000-01-01T00:00:02.2306000+00:00
macos
s 0 2000-01-01T00:00:00.0000000+00:00
i 0 2000-01-01T00:00:01.0000000+00:00
s 3 2000-01-01T00:00:01.0000000+00:00
i 2 2000-01-01T00:00:01.0014600+00:00
s 4 2000-01-01T00:00:01.0000000+00:00
i 6 2000-01-01T00:00:01.6099300+00:00
*/


TestContext.Current.TestOutputHelper!.WriteLine($"s 0 {scheduledOrchestrationEvents[0].Timestamp:o}");
TestContext.Current.TestOutputHelper!.WriteLine($"i 0 {instantOrchestrationEvents[0].Timestamp:o}");

TestContext.Current.TestOutputHelper!.WriteLine($"s 3 {scheduledOrchestrationEvents[3].Timestamp:o}");
TestContext.Current.TestOutputHelper!.WriteLine($"i 2 {instantOrchestrationEvents[2].Timestamp:o}");

TestContext.Current.TestOutputHelper!.WriteLine($"s 4 {scheduledOrchestrationEvents[4].Timestamp:o}");
TestContext.Current.TestOutputHelper!.WriteLine($"i 6 {instantOrchestrationEvents[6].Timestamp:o}");

// Scheduled orchestration should have started before the instant job related one...
Assert.True(scheduledOrchestrationEvents[0].Timestamp < instantOrchestrationEvents[0].Timestamp);

Expand Down
2 changes: 1 addition & 1 deletion tests/NCronJob.Tests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private readonly CancellationTokenSource cancellationTokenSource
protected CancellationToken CancellationToken => cancellationTokenSource.Token;
protected Channel<object> CommunicationChannel { get; } = Channel.CreateUnbounded<object>();
protected ServiceCollection ServiceCollection { get; }
protected FakeTimeProvider FakeTimer { get; } = new();
protected FakeTimeProvider FakeTimer { get; } = new() { AutoAdvanceAmount = TimeSpan.FromMilliseconds(1) };

protected JobIntegrationBase()
{
Expand Down

0 comments on commit c441361

Please sign in to comment.