-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration Tests
: prevent false positives when purchasing returns 5xx
#3209
Conversation
func verifyCustomerInfoWasComputedOffline( | ||
logger: TestLogHandler? = nil, | ||
file: FileString = #file, | ||
line: UInt = #line | ||
) { | ||
let logger: TestLogHandler = logger ?? self.logger | ||
logger.verifyMessageWasLogged( | ||
Strings.offlineEntitlements.computing_offline_customer_info, | ||
level: .info, | ||
file: file, | ||
line: line | ||
) | ||
} | ||
|
||
func verifyCustomerInfoWasNotComputedOffline( | ||
logger: TestLogHandler? = nil, | ||
file: FileString = #file, | ||
line: UInt = #line | ||
) { | ||
let logger: TestLogHandler = logger ?? self.logger | ||
|
||
logger.verifyMessageWasNotLogged( | ||
Strings.offlineEntitlements.computing_offline_customer_info, | ||
file: file, | ||
line: line | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the new methods
self.verifyNoTransactionsWereFinished() | ||
} | ||
|
||
@available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) | ||
func testPurchaseWhileServerIsDownPostsReceiptAfterServerComesBack() async throws { | ||
self.logger.clearMessages() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small improvement in this test. The verifyNoTransactionsWereFinished
was being affected by leftover transaction before the test started.
831bc21
to
66b5048
Compare
e30660c
to
aa6582b
Compare
aa6582b
to
967861c
Compare
Good news: offline entitlements are amazing, and our SDK is very resilient to the backend being down. Bad news: this is kind of a false positive, this behavior is already verified by `OfflineStoreKitIntegrationTests`. I refactored `BaseStoreKitIntegrationTests` because it had grown a lot. I put this verification in the `purchase` methods so all tests benefit from this. So that `OfflineStoreKitIntegrationTests` doesn't fail, I added a parameter to ignore those there.
967861c
to
0850d71
Compare
Good news: offline entitlements are amazing, and our SDK is very resilient to the backend being down.
Bad news: this is kind of a false positive, this behavior is already verified by
OfflineStoreKitIntegrationTests
.I refactored
BaseStoreKitIntegrationTests
because it had grown a lot. I put this verification in thepurchase
methods so all tests benefit from this.So that
OfflineStoreKitIntegrationTests
don't fail, I added a parameter to ignore that verification in those tests.