Skip to content

LifecycleTests.testCancellation is flaky in CI #2783

Description

@hamishknight

This test can sometimes fail in CI if sourcekitd takes too long to cancel:

Test Case 'LifecycleTests.testCancellation' started at 2026-10-02 06:56:58.507

C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\sourcekit-lsp\Tests\SourceKitLSPTests\LifecycleTests.swift:144: error: LifecycleTests.testCancellation : XCTAssertLessThan failed: ("2.8379554748535156") is not less than ("2.0") - Cursor info request wasn't fast. sourcekitd still blocked?

Test Case 'LifecycleTests.testCancellation' failed (3.865 seconds)

The intention of the test is to ensure that type-checking cancellation works and can interrupt the constraint solver (ensuring it doesn't block future semantic requests). There are a few things we should do to make this more reliable:

  • We should replace the slow expression with a flag that simulates a slow expression in the type-checker
  • We should change the expectation to simply be "did we cancel before the simulated slow expression finished". Since it will be simulated we can make it take a long enough time to be reliable

Activity

  1. self-assigned this
    on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions