Skip to content

ReceiptFetcherTests: refactored tests using waitUntilValue#2144

Merged
NachoSoto merged 1 commit into
mainfrom
receipt-fetcher-tests-refactor
Dec 13, 2022
Merged

ReceiptFetcherTests: refactored tests using waitUntilValue#2144
NachoSoto merged 1 commit into
mainfrom
receipt-fetcher-tests-refactor

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

See also #2071.

@NachoSoto NachoSoto requested a review from a team December 13, 2022 17:31
Base automatically changed from callback-cache-compilation-error to main December 13, 2022 17:37
@NachoSoto NachoSoto merged commit af45a97 into main Dec 13, 2022
@NachoSoto NachoSoto deleted the receipt-fetcher-tests-refactor branch December 13, 2022 19:15
NachoSoto pushed a commit that referenced this pull request Dec 14, 2022
**This is an automatic release.**

### Bugfixes
* Un-deprecate `Purchases.configure(withAPIKey:appUserID:)` and
`Purchases.configure(withAPIKey:appUserID:observerMode:)` (#2129) via
NachoSoto (@NachoSoto)
### Other Changes
* `ReceiptFetcherTests`: refactored tests using `waitUntilValue` (#2144)
via NachoSoto (@NachoSoto)
* Added a few performance improvements for `ReceiptParser` (#2124) via
NachoSoto (@NachoSoto)
* `CallbackCache`: fixed reference (#2143) via NachoSoto (@NachoSoto)
* `PostReceiptDataOperation`: clarified receipt debug log (#2128) via
NachoSoto (@NachoSoto)
* `CallbackCache`: avoid exposing internal mutable cache (#2136) via
NachoSoto (@NachoSoto)
* `CallbackCache`: added assertion for tests to ensure we don't leak
callbacks (#2137) via NachoSoto (@NachoSoto)
* `NetworkOperation`: made `Atomic` references immutable (#2139) via
NachoSoto (@NachoSoto)
* `ReceiptParser`: ensure parsing never happens in the main thread
(#2123) via NachoSoto (@NachoSoto)
* `PostReceiptDataOperation`: also print receipt data with `verbose`
logs (#2127) via NachoSoto (@NachoSoto)
* `BasePurchasesTests`: detecting and fixing many `DeviceCache` leaks
(#2105) via NachoSoto (@NachoSoto)
* `StoreKitIntegrationTests`: added test to check applying a promotional
offer during subscription (#1588) via NachoSoto (@NachoSoto)
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 19, 2022
See also #2071 and #2144.

I broke this tests recently, and because we're using `toEventually` they each take 1 second to fail, instead of failing immediately after the request finishes.
NachoSoto added a commit that referenced this pull request Dec 20, 2022
NachoSoto added a commit that referenced this pull request Dec 21, 2022
See also #2071 and #2144.

I broke these tests recently, and because we're using `toEventually`
they each take over 1 second to fail, instead of failing immediately
after the request finishes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants