Skip to content
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

Tests: fixed flaky failure with asynchronous check #2777

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

NachoSoto
Copy link
Contributor

The getCustomerInfo call is asynchronous, so this expectation should be too.

I also renamed the old property name to "customer".

The `getCustomerInfo` call is asynchronous, so this expectation should be too.
@NachoSoto NachoSoto added the test label Jul 10, 2023
@NachoSoto NachoSoto requested a review from a team July 10, 2023 16:56
@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #2777 (cbd65b9) into main (14e5906) will increase coverage by 0.16%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2777      +/-   ##
==========================================
+ Coverage   86.30%   86.47%   +0.16%     
==========================================
  Files         214      214              
  Lines       15376    15376              
==========================================
+ Hits        13271    13296      +25     
+ Misses       2105     2080      -25     

see 4 files with indirect coverage changes

@NachoSoto NachoSoto enabled auto-merge (squash) July 11, 2023 14:44
@NachoSoto NachoSoto merged commit 1f83693 into main Jul 11, 2023
2 checks passed
@NachoSoto NachoSoto deleted the logoug-flaky-failure branch July 11, 2023 14:44
@@ -65,7 +65,7 @@ class PurchasesLogInTests: BasePurchasesTests {
self.identityManager.mockLogOutError = nil
self.backend.overrideCustomerInfoResult = .success(Self.mockLoggedOutInfo)

expect(self.backend.getSubscriberCallCount) == 1
expect(self.backend.getCustomerInfoCallCount).toEventually(equal(1))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change

NachoSoto added a commit that referenced this pull request Jul 11, 2023
This was referenced Jul 11, 2023
NachoSoto added a commit that referenced this pull request Jul 11, 2023
**This is an automatic release.**

### New Features
* `Trusted Entitlements`: (#2621) via NachoSoto (@NachoSoto)

This new feature prevents MitM attacks between the SDK and the
RevenueCat server.
With verification enabled, the SDK ensures that the response created by
the server was not modified by a third-party, and the entitlements
received are exactly what was sent.
This is 100% opt-in. `EntitlementInfos` have a new `VerificationResult`
property, which will indicate the validity of the responses when this
feature is enabled.

```swift
let purchases = Purchases.configure(
  with: Configuration
    .builder(withAPIKey: "")
    .with(entitlementVerificationMode: .informational)
)
let customerInfo = try await purchases.customerInfo()
if !customerInfo.entitlements.verification.isVerified {
  print("Entitlements could not be verified")
}
```

You can learn more from [the
documentation](https://www.revenuecat.com/docs/trusted-entitlements).

### Other Changes
* `TrustedEntitlements`: new `VerificationResult.isVerified` (#2788) via
NachoSoto (@NachoSoto)
* `Refactor`: extracted `Collection.subscript(safe:)` (#2779) via
NachoSoto (@NachoSoto)
* `Trusted Entitlements`: added link to docs in
`ErrorCode.signatureVerificationFailed` (#2783) via NachoSoto
(@NachoSoto)
* `Trusted Entitlements`: improved documentation (#2782) via NachoSoto
(@NachoSoto)
* `Tests`: fixed flaky failure with asynchronous check (#2777) via
NachoSoto (@NachoSoto)
* `Integration Tests`: re-enable signature verification tests (#2744)
via NachoSoto (@NachoSoto)
* `CI`: remove `Jazzy` (#2775) via NachoSoto (@NachoSoto)
* `Signing`: inject `ClockType` to ensure hardcoded signatures don't
fail when intermediate key expires (#2771) via NachoSoto (@NachoSoto)

---------

Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
NachoSoto added a commit that referenced this pull request Jul 12, 2023
Similar to #2786 and #2777.
This test was verifying `getCustomerInfoCallCount`, but that gets updated asynchronously since #2533.

The correct version waits for it to be updated, then ensures that it doesn't get updated again after logging out.
NachoSoto added a commit that referenced this pull request Jul 12, 2023
Similar to #2786 and #2777.
This test was verifying `getCustomerInfoCallCount`, but that gets
updated asynchronously since #2533.

The correct version waits for it to be updated, then ensures that it
doesn't get updated again after logging out.

Fixes
https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/12762/workflows/a7e8c4ac-cecb-4c25-90ff-4390ed226bc4/jobs/88794
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