Skip to content

ignore fact creation timestamp comparison in scheduling unit test#3215

Merged
deacon-mp merged 2 commits into
masterfrom
VIRTS-5000
Oct 14, 2025
Merged

ignore fact creation timestamp comparison in scheduling unit test#3215
deacon-mp merged 2 commits into
masterfrom
VIRTS-5000

Conversation

@uruwhy
Copy link
Copy Markdown
Contributor

@uruwhy uruwhy commented Oct 14, 2025

Description

tests/api/v2/handlers/test_schedules_api.py:183 would often fail due to a race condition where a fact creation date would be off by 1 second from the expected value. This fix replaces the expected creation date with a mock placeholder catch-all to avoid this issue, since the fact creation date is not part of the unit test criteria.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Ran test via workflow

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@sonarqubecloud
Copy link
Copy Markdown

@deacon-mp deacon-mp requested a review from Copilot October 14, 2025 15:36
Copy link
Copy Markdown
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 race condition in a scheduling unit test where fact creation timestamps could differ by 1 second from expected values, causing intermittent test failures. The fix uses a mock placeholder to ignore timestamp comparisons since the creation date is not part of the test criteria.

  • Replaces specific timestamp expectations with mock.ANY for fact creation dates
  • Prevents race condition failures in test assertions
  • Maintains test integrity by only ignoring non-essential timestamp data

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@deacon-mp deacon-mp merged commit 38bc3d4 into master Oct 14, 2025
17 checks passed
@deacon-mp deacon-mp deleted the VIRTS-5000 branch October 14, 2025 15:38
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.

3 participants