Skip to content

[WIP] Add DNSSEC for iOS 16#2561

Closed
aboedo wants to merge 1 commit into
mainfrom
andy/sdk-3156-ios-add-dnssec-and-dns-over-https
Closed

[WIP] Add DNSSEC for iOS 16#2561
aboedo wants to merge 1 commit into
mainfrom
andy/sdk-3156-ios-add-dnssec-and-dns-over-https

Conversation

@aboedo

@aboedo aboedo commented May 29, 2023

Copy link
Copy Markdown
Member

Addresses #2560.

Sets DNSSEC for URLSession. I need to test more in detail, but so far it seems to work just fine with no surprises.
I also ended up doing a few things for the sake of testing:

  • extracted the URLSessionConfiguration creation into a factory
  • created tests for it and a mock
  • passed it in through DI to the HTTPClient
  • added availability checks for iOS 16 for tests

@aboedo aboedo requested a review from a team May 29, 2023 15:16
@aboedo aboedo self-assigned this May 29, 2023
@aboedo

aboedo commented May 29, 2023

Copy link
Copy Markdown
Member Author

marking as draft because I only tested in unit tests and against a single device. Also we need to test this against RC Fortress.

@aboedo aboedo added the perf label May 29, 2023
@aboedo

aboedo commented May 29, 2023

Copy link
Copy Markdown
Member Author

I'm really confused as to why tests for iOS 14 are failing compilation, but the ones for iOS 15 aren't, when the only relevant API is iOS 16 only

@NachoSoto

Copy link
Copy Markdown
Contributor

Because the API isn't visible when compiling with Xcode 13.x
Can't wait to finish #2421

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice 👏🏻

}
}

static func iOS16APIAvailableOrSkipTest() throws {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First time doing this 🎉


struct URLSessionConfigurationFactory: URLSessionConfigurationFactoryType {

func urlSessionConfiguration(requestTimeout: TimeInterval) -> URLSessionConfiguration {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This name is very Obj-C. How about just createConfiguration()? The rest is all in the types.

config.timeoutIntervalForRequest = requestTimeout
config.timeoutIntervalForResource = requestTimeout
self.session = URLSession(configuration: config,
requestTimeout: TimeInterval = Configuration.networkTimeoutDefault,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this parameter isn't need anymore?

import Foundation

protocol URLSessionConfigurationFactoryType {
func urlSessionConfiguration(requestTimeout: TimeInterval) -> URLSessionConfiguration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't care that much, but we should decide whether we want to keep the consistency in the style guide of spaces around types.


class URLSessionConfigurationFactoryTests: TestCase {

var factory: URLSessionConfigurationFactory!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: This can be private

factory = URLSessionConfigurationFactory()
}

override func tearDown() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't really necessary

}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, *)
func testRequiresDNSSECValidation() throws {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome

@NachoSoto NachoSoto changed the title add DNSSEC for iOS 16 [WIP] Add DNSSEC for iOS 16 Jun 13, 2023

@testable import RevenueCat

class URLSessionConfigurationFactoryTests: TestCase {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is awesome. Let's add a test to cover the change in #2668 too.

@NachoSoto

Copy link
Copy Markdown
Contributor

Should we close this?

@NachoSoto NachoSoto closed this Jan 16, 2024
@vegaro vegaro deleted the andy/sdk-3156-ios-add-dnssec-and-dns-over-https branch March 21, 2024 12:49
@vegaro vegaro added pr:other and removed pr:perf labels Sep 17, 2024
@codecov

codecov Bot commented Sep 17, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.90%. Comparing base (beb3c8f) to head (06cc467).
Report is 1098 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2561      +/-   ##
==========================================
+ Coverage   87.85%   87.90%   +0.04%     
==========================================
  Files         201      202       +1     
  Lines       13871    13878       +7     
==========================================
+ Hits        12187    12200      +13     
+ Misses       1684     1678       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants