Integration Tests: fix flaky test failure due to leftover transaction#3167
Merged
Conversation
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/14917/workflows/4f22199c-2229-45da-8758-9587559d02be/jobs/119481/tests This test was failing with this error: > failed - Message 'Finishing transaction' should not have been logged I looked through the logs, and noticed that transaction had been finished prior to the test even starting (before `.serverDown()` was called), likely due to a leftover transaction from an earlier test (this can still happen with `SKTestSession` despite our best efforts. Supposedly fully fixed in iOS 17). This removes that possibility by clearing the log history at the beginning of the test.
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #3167 +/- ##
==========================================
- Coverage 86.64% 86.62% -0.02%
==========================================
Files 220 220
Lines 15742 15742
==========================================
- Hits 13639 13637 -2
- Misses 2103 2105 +2 ☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
tonidero
approved these changes
Sep 8, 2023
This was referenced Sep 13, 2023
NachoSoto
pushed a commit
that referenced
this pull request
Sep 14, 2023
**This is an automatic release.** ### Bugfixes * Fix runtime crash in SK2TransactionListener in iOS < 15 (#3206) via Toni Rico (@tonidero) ### Performance Improvements * `OperationDispatcher`: add support for "long" delays (#3168) via NachoSoto (@NachoSoto) ### Other Changes * `Integration Tests`: add tests for ghost transfer behavior (#3135) via NachoSoto (@NachoSoto) * `Xcode`: removed `purchases-ios` SPM reference (#3166) via NachoSoto (@NachoSoto) * `Integration Tests`: another flaky failure (#3165) via NachoSoto (@NachoSoto) * `Integration Tests`: fix flaky test failure due to leftover transaction (#3167) via NachoSoto (@NachoSoto) * `Xcode 13`: removed last `Swift 5.7` checks (#3161) via NachoSoto (@NachoSoto) * `Integration Tests`: improve flaky tests (#3163) via NachoSoto (@NachoSoto) * `Codable`: improved decoding errors (#3153) via NachoSoto (@NachoSoto) * Refactor: extract `HealthOperation` (#3154) via NachoSoto (@NachoSoto) * `Xcode 13`: remove conditional code (#3147) via NachoSoto (@NachoSoto) * `CircleCI`: change all jobs to use `Xcode 14.x` and replace `xcode-install` with `xcodes` (#2421) via NachoSoto (@NachoSoto)
NachoSoto
added a commit
that referenced
this pull request
Sep 14, 2023
Same as #3167. These can fail when verifying that no transactions are finished because there might be leftover transactions before the test even begins. In order to ignore those, we clear `TestLogHandler` at the beginning. We don't do that for every test because in some test we want to look at what was logged during SDK initialization.
NachoSoto
added a commit
that referenced
this pull request
Sep 15, 2023
Same as #3167. These can fail when verifying that no transactions are finished because there might be leftover transactions before the test even begins. In order to ignore those, we clear `TestLogHandler` at the beginning. We don't do that for every test because in some test we want to look at what was logged during SDK initialization.
NachoSoto
added a commit
that referenced
this pull request
Sep 15, 2023
Same as #3167. These can fail when verifying that no transactions are finished because there might be leftover transactions before the test even begins. In order to ignore those, we clear `TestLogHandler` at the beginning. We don't do that for every test because in some test we want to look at what was logged during SDK initialization.
NachoSoto
added a commit
that referenced
this pull request
Sep 15, 2023
Same as #3167. These can fail when verifying that no transactions are finished because there might be leftover transactions before the test even begins. In order to ignore those, we clear `TestLogHandler` at the beginning. We don't do that for every test because in some test we want to look at what was logged during SDK initialization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/14917/workflows/4f22199c-2229-45da-8758-9587559d02be/jobs/119481/tests
This test was failing with this error:
I looked through the logs, and noticed that transaction had been finished prior to the test even starting (before
.serverDown()was called), likely due to a leftover transaction from an earlier test (this can still happen withSKTestSessiondespite our best efforts. Supposedly fully fixed in iOS 17).This removes that possibility by clearing the log history at the beginning of the test.