From 1844609f0e0a055745af6a2309d6e426ef3c36ed Mon Sep 17 00:00:00 2001 From: arzafran Date: Wed, 29 Jul 2026 15:46:54 -0300 Subject: [PATCH] fix: give the slow-runner test waits the same headroom as everything else The test suite already knows CI machines are slower and stretches its waiting times four times longer when it runs there. That stretch was added to most of the suite but never to the window and overlay tests, which still waited for a fixed few seconds no matter how loaded the machine was. Those are the tests that have been failing on the older macOS runner, and a different handful failed each time, which is what losing a race looks like rather than something being broken. The class sitting right next to them in the same file already had the stretch and has been fine. Both waiting helpers now stretch the same way, so all of their tests get the same headroom the rest of the suite has had. --- programaTests/TerminalAndGhosttyTests.swift | 11 ++++++++++- programaTests/WorkspaceUnitTests.swift | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/programaTests/TerminalAndGhosttyTests.swift b/programaTests/TerminalAndGhosttyTests.swift index aff6f628..03810940 100644 --- a/programaTests/TerminalAndGhosttyTests.swift +++ b/programaTests/TerminalAndGhosttyTests.swift @@ -2102,7 +2102,16 @@ final class GhosttySurfaceOverlayTests: XCTestCase { }, object: NSObject() ) - let result = XCTWaiter().wait(for: [expectation], timeout: timeout) + // Scaled by `ciScale` (TabManagerUnitTests.swift) for the same reason + // TerminalWindowPortalLifecycleTests below scales its own spins: every test in + // this class mounts a real NSWindow and waits for a SwiftUI/AppKit overlay to + // attach, so the budget is spent on main-run-loop turns that compete with the + // backlog a full serial suite leaves behind. The raw 3s and 10s literals the + // call sites pass are comfortable locally and marginal on a loaded CI runner, + // which is why this class was the bulk of the macos-15 compat failures while + // the already-scaled class beside it stayed green. Scaling here rather than at + // each call site keeps all 11 of them consistent. + let result = XCTWaiter().wait(for: [expectation], timeout: timeout * ciScale) guard result == .completed else { XCTFail("Timed out waiting for \(description)", file: file, line: line) return false diff --git a/programaTests/WorkspaceUnitTests.swift b/programaTests/WorkspaceUnitTests.swift index 8f76856d..0f53be0a 100644 --- a/programaTests/WorkspaceUnitTests.swift +++ b/programaTests/WorkspaceUnitTests.swift @@ -2036,7 +2036,10 @@ final class WorkspaceSplitWorkingDirectoryTests: XCTestCase { pollInterval: TimeInterval = 0.01, _ condition: () -> Bool ) -> Bool { - let deadline = Date().addingTimeInterval(timeout) + // Scaled by `ciScale` (TabManagerUnitTests.swift), matching the copy of this + // helper in that file. This one polls the main run loop for a real window to + // settle, so a flat 2s is comfortable locally and thin on a loaded CI runner. + let deadline = Date().addingTimeInterval(timeout * ciScale) while Date() < deadline { if condition() { return true