Extracted asyncWait to poll async conditions in tests#2134
Merged
Conversation
afe97dc to
7d62a15
Compare
This is necessary because we can't use `Quick` v6.x yet. Abstracting this out to use it in #2069.
6be30db to
6a1d26f
Compare
NachoSoto
added a commit
that referenced
this pull request
Dec 15, 2022
…ottle errors (#2146) Fixes #2116. Depends on #2134, #2144, #2145. We've known that, especially for sandbox accounts with lots of purchases, the SDK can get flooded with a lot of transactions to process at once. I've been making some improvements for this (like #2115). Another consequence of this behavior, is that we can end up failing due to `StoreKit` throttling us (see #2116): > 2022-12-03 12:31:58.670892+0100 app[673:61074] <SKReceiptRefreshRequest: 0x283edc860>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=603 "Request throttled" UserInfo={NSLocalizedFailureReason=Unified receipt is valid and current, NSLocalizedDescription=Request throttled, AMSServerErrorCode=0} This change avoids that by skipping the refresh if less than 2 seconds have elapsed. I chose 2 to make this a low-ish risk change, with a huge benefit for multiple semi-concurrent requests coming from a big transaction queue.
NachoSoto
added a commit
that referenced
this pull request
Dec 15, 2022
) See [TRIAGE-179]. I wrote all these to cover the change in #2063. I wrote a failing test that only passed with the change in #2063. However, when running that in SK1, that would fail. With the change as suggested in #2063, the SK2 behavior would differ from SK1. From the `Transaction.all` docs: > This sequence returns the user’s transaction history current to the moment you access the sequence. The sequence emits a finite number of transactions. If the App Store processes new transactions for the user while you’re accessing this sequence, the new transactions appear in the transaction listener, updates. These new tests verify the behavior of the SDK when encountering transactions created prior to initializing the SDK, and some made after initialization. Integration tests now are as follows: - `BaseStoreKitIntegrationTests` - `StoreKit1IntegrationTests` - `StoreKit2IntegrationTests` - `BaseStoreKitObserverModeIntegrationTests`: - `StoreKit1ObserverModeIntegrationTests` - `StoreKit2ObserverModeIntegrationTests` - `StoreKit1ObserverModeWithExistingPurchasesTests` - `StoreKit2ObserverModeWithExistingPurchasesTests` Depends on #2064, #2066, and #2134. [TRIAGE-179]: https://revenuecats.atlassian.net/browse/TRIAGE-179?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
NachoSoto
pushed a commit
that referenced
this pull request
Dec 15, 2022
**This is an automatic release.** ### Bugfixes * Fix sending presentedOfferingIdentifier in StoreKit2 (#2156) via Toni Rico (@tonidero) * `ReceiptFetcher`: throttle receipt refreshing to avoid `StoreKit` throttle errors (#2146) via NachoSoto (@NachoSoto) ### Other Changes * Added integration and unit tests to verify observer mode behavior (#2069) via NachoSoto (@NachoSoto) * Created `ClockType` and `TestClock` to be able to mock time (#2145) via NachoSoto (@NachoSoto) * Extracted `asyncWait` to poll `async` conditions in tests (#2134) via NachoSoto (@NachoSoto) * `StoreKitRequestFetcher`: added log when starting/ending requests (#2151) via NachoSoto (@NachoSoto) * `CI`: fixed `PurchaseTester` deployment (#2147) via NachoSoto (@NachoSoto)
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.
This is necessary because we can't use
Quickv6.x yet.Abstracting this out to use it in #2069.