Skip to content

Fix flaky test - #632

Merged
hannesa2 merged 1 commit into
masterfrom
FixFlakyTest
Sep 13, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
FixFlakyTest

Conversation

@hannesa2

Copy link
Copy Markdown
Contributor

I see it here https://github.com/gitx/gitx/actions/runs/34750376507/job/103705883239?pr=625

It's a flaky CI timing issue: postIndexRefreshSuccess: posts via dispatch_async(main queue, …), and the test's waitForExpectations:timeout:1.0 is tight on a loaded CI runner

close #631

It's a flaky CI timing issue: postIndexRefreshSuccess: posts via dispatch_async(main queue, …), and the test's waitForExpectations:timeout:1.0 is tight on a loaded CI runner
@hannesa2 hannesa2 added the test Test related label Sep 13, 2026
@hannesa2
hannesa2 requested a review from goneng September 13, 2026 10:25
@hannesa2

Copy link
Copy Markdown
Contributor Author

Screenshot differs: emulatorApi=arm64 with 4 screenshot(s)

setpoint (old) | diff | actual screenshot (new)

00-commit-context-menu.pngscreenshot

01-history-view.pngscreenshot

02-main-window.pngscreenshot

03-staging-view.pngscreenshot

@goneng goneng left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diagnosis looks right - looks like the wait really was too tight...

The cost is the catch: an inverted expectation burns the whole timeout regardless,
so these two tests go from 1s each to 5s each.
The class goes 2.0s to 10.0s, and the full suite from 6.2s to about 14s.
Every other test in the class runs in 0.001s.

Splitting the wait gets the headroom without paying for it:

[self waitForExpectations:@[ statusReported ] timeout:5.0];
[self waitForExpectations:@[ indexAnnounced ] timeout:0.1];

The first returns as soon as the notification lands but still tolerates a 5 second stall, so the flaky half is covered.

@hannesa2

Copy link
Copy Markdown
Contributor Author

We can wait to see how often it appears.
On the other side a re-trigger of the failing job costs almost 10 minutes

@goneng

goneng commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

I would fix this one, including the above small modification - it saves 5 seconds and still keeps the longer delay where it is required.
(if you prefer not to touch - let's merge it as-is, as it improves reliability anyhow)

@hannesa2
hannesa2 merged commit 1fc5058 into master Sep 13, 2026
3 checks passed
@hannesa2
hannesa2 deleted the FixFlakyTest branch September 13, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Found a flaky test

2 participants