Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See the flakes in https://github.com/firebase/firebase-ios-sdk/actions/runs/19787052556/job/56694978667 These have been recurring in nightly test runs.
Here's Gemini's analyis:
✦ I've reviewed FIRMessagingPendingTopicsListTest.m, and the flaky tests are all caused by race conditions in the asynchronous operations. The timeouts occur
because the expectations are not being fulfilled consistently. I've identified the issues and will now fix them.
My plan is to:
testBatchSizeReductionAfterSuccessfulTopicUpdate: The test hangs because the subscriptionHandler is called for every topic operation, but theexpectation is only fulfilled for a single topic. I will introduce a counter to ensure all topic updates are processed before the test completes.
testCompletionOfTopicUpdatesInSameThread: This test fails because it relies on an updateHandler that is not always called. I will add a counter andan explicit expectation to ensure that all topic operations complete successfully.
testAddingTopicToCurrentBatchWhileCurrentBatchTopicsInFlight: This test is flaky because it relies on a fixed delay, which is not a reliable way totest asynchronous code. I will restructure the test to ensure that the "straggler" topic is added at the correct time, and I'll add an expectation to
confirm that both topics are processed.
✦ I've analyzed FIRMessagingExtensionHelperTest.m and found testModifyNotificationWithEmptyPayloadData fails because validPayloadExpectation isn't met. The issue
stems from an invalid image URL preventing the handler block from executing. My fix will entail: 1) correcting the test's content.userInfo to truly represent
an "empty" payload, removing the invalid image URL, and 2) adjusting the expectation to verify loadAttachmentForURL is not called, but the handler is called
with the original content. I'll begin by modifying content.userInfo to reflect an empty payload and confirming loadAttachmentForURL is rejected.