Skip to content

Adjust a timing-sensitive TimeLimitTrait test to avoid flakiness in CI #1029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

stmontgomery
Copy link
Contributor

This adjusts the TimeLimitTraitTests.cancelledTestExitsEarly() test function to make it less sensitive to running on resource-constrained CI systems.

Motivation:

Recently on a few PRs I have seen flaky results from this test which are unrelated to my work. They typically show up as console output such as:

✘ Test "Cancelled tests can exit early (cancellation checking works)" recorded an issue
  at TimeLimitTraitTests.swift:193:5: Expectation failed:
  (timeAwaited → 5.108262525 seconds) < (.seconds(5) → 5.0 seconds)

This indicates the test is just a little too sensitive to specific timing.

Modifications:

  • Lengthen the "full" sleep duration the test would run if it wasn't cancelled, which it is.
  • Extend the much shorter duration it allows for waiting, to avoid false positives when running on resource-constrained CI systems.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@stmontgomery stmontgomery added bug 🪲 Something isn't working performance 🏎️ Performance issues labels Mar 17, 2025
@stmontgomery stmontgomery added this to the Swift 6.2 milestone Mar 17, 2025
@stmontgomery stmontgomery self-assigned this Mar 17, 2025
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@stmontgomery stmontgomery merged commit 6bc562d into swiftlang:main Mar 17, 2025
3 checks passed
@stmontgomery stmontgomery deleted the sleep-cancellation-test branch March 17, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working performance 🏎️ Performance issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants