Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

PR Summary

utcNow() tests have proven to be fragile due to a race condition of when the function is called and when the PowerShell equivalent used for comparison is called. In particularly if the second, minute, or hour just clicked over, then it fails.

Since we are primarily focused on the format, use a regex to verify instead of trying to verify the value.

@SteveL-MSFT SteveL-MSFT requested review from Copilot and tgauth August 8, 2025 19:11
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 updates the utcNow() function tests to use regex validation instead of direct datetime comparisons, addressing race condition issues where timing differences between the function call and PowerShell equivalent could cause test failures.

  • Replace direct datetime value comparisons with regex pattern matching
  • Add comprehensive regex patterns for different datetime formats
  • Include additional test case for ISO format with seconds

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Aug 12, 2025
Merged via the queue into PowerShell:main with commit d4cee44 Aug 12, 2025
6 of 7 checks passed
@SteveL-MSFT SteveL-MSFT deleted the utcnow-tests branch August 12, 2025 05:30
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