Skip to content

Fix tests not passing on macOS with .NET Core 10#66

Merged
jeanlrnt merged 2 commits intomainfrom
copilot/fix-tests-on-macos-dotnet10
Jan 3, 2026
Merged

Fix tests not passing on macOS with .NET Core 10#66
jeanlrnt merged 2 commits intomainfrom
copilot/fix-tests-on-macos-dotnet10

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

Fixed the InMemoryJobLockProvider_ConcurrentAcquireAndRelease_ThreadSafe test that was failing on macOS with .NET 10.

Root Cause

The test used a 50ms TTL (time-to-live) for locks, but with 20 concurrent threads each holding the lock for 10ms, there was a race condition where locks could expire while threads still believed they held the lock. This was particularly problematic on macOS with .NET 10 due to different timing/scheduling behavior.

Changes Made

  • Increased the TTL from TimeSpan.FromMilliseconds(50) to TimeSpan.FromSeconds(10) in the InMemoryJobLockProvider_ConcurrentAcquireAndRelease_ThreadSafe test
  • Added explanatory comment to clarify why a long TTL is needed

This makes the test more robust across different platforms and .NET versions by ensuring locks don't expire during normal hold periods in the test.

Testing

  • ✅ Test passes consistently (10 consecutive runs)
  • ✅ All 17 InMemoryJobLockProvider tests pass
  • ✅ Full test suite passes (155/155 tests)
  • ✅ Code review: No issues
  • ✅ Security scan: No alerts

The fix is minimal and surgical, addressing only the timing issue in the test without changing any production code.

Original prompt

Les tests ne passent pas sur macos avec la version 10 de .net core jai cette erreur aides moi :


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@jeanlrnt
Copy link
Owner

jeanlrnt commented Jan 3, 2026

@copilot Continue

…tion on macOS - MiniCronTests.InMemoryLockProvider.cs

Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 3, 2026

@copilot Continue

Fixed in commit 2632d15. The issue was a race condition in the InMemoryJobLockProvider_ConcurrentAcquireAndRelease_ThreadSafe test where the 50ms TTL was too short, allowing locks to expire while threads still considered themselves to be holding the lock. Increased the TTL to 10 seconds to prevent this timing-sensitive issue on macOS with .NET 10. All 155 tests now pass.

Copilot AI changed the title [WIP] Fix tests not passing on macOS with .NET Core 10 Fix tests not passing on macOS with .NET Core 10 Jan 3, 2026
@jeanlrnt jeanlrnt marked this pull request as ready for review January 3, 2026 13:55
Copilot AI review requested due to automatic review settings January 3, 2026 13:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a flaky test that was failing on macOS with .NET 10 due to a race condition caused by insufficient lock TTL (time-to-live). The test was using a 50ms TTL with 20 concurrent threads each holding locks for 10ms, causing locks to expire prematurely under certain timing/scheduling conditions specific to macOS and .NET 10.

  • Increased the lock TTL from 50ms to 10 seconds in the InMemoryJobLockProvider_ConcurrentAcquireAndRelease_ThreadSafe test
  • Added an explanatory comment to clarify the rationale for the longer TTL

@jeanlrnt jeanlrnt merged commit 35ac855 into main Jan 3, 2026
11 checks passed
@jeanlrnt jeanlrnt deleted the copilot/fix-tests-on-macos-dotnet10 branch January 3, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments