Skip to content

Avoid using deprecated API in tests #762

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

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Tests/AsyncHTTPClientTests/AsyncAwaitEndToEndTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,10 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
/// openssl req -x509 -newkey rsa:4096 -keyout self_signed_key.pem -out self_signed_cert.pem -sha256 -days 99999 -nodes -subj '/CN=localhost'
let certPath = Bundle.module.path(forResource: "self_signed_cert", ofType: "pem")!
let keyPath = Bundle.module.path(forResource: "self_signed_key", ofType: "pem")!
let key = try NIOSSLPrivateKey(file: keyPath, format: .pem)
let configuration = TLSConfiguration.makeServerConfiguration(
certificateChain: try NIOSSLCertificate.fromPEMFile(certPath).map { .certificate($0) },
privateKey: .file(keyPath)
privateKey: .privateKey(key)
)
let sslContext = try NIOSSLContext(configuration: configuration)
let serverGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
Expand Down Expand Up @@ -597,10 +598,11 @@ final class AsyncAwaitEndToEndTests: XCTestCase {
/// ```
let certPath = Bundle.module.path(forResource: "example.com.cert", ofType: "pem")!
let keyPath = Bundle.module.path(forResource: "example.com.private-key", ofType: "pem")!
let key = try NIOSSLPrivateKey(file: keyPath, format: .pem)
let localhostCert = try NIOSSLCertificate.fromPEMFile(certPath)
let configuration = TLSConfiguration.makeServerConfiguration(
certificateChain: localhostCert.map { .certificate($0) },
privateKey: .file(keyPath)
privateKey: .privateKey(key)
)
let bin = HTTPBin(.http2(tlsConfiguration: configuration))
defer { XCTAssertNoThrow(try bin.shutdown()) }
Expand Down
6 changes: 4 additions & 2 deletions Tests/AsyncHTTPClientTests/HTTPClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1274,9 +1274,10 @@ final class HTTPClientTests: XCTestCaseHTTPClientTestsBaseClass {
/// openssl req -x509 -newkey rsa:4096 -keyout self_signed_key.pem -out self_signed_cert.pem -sha256 -days 99999 -nodes -subj '/CN=localhost'
let certPath = Bundle.module.path(forResource: "self_signed_cert", ofType: "pem")!
let keyPath = Bundle.module.path(forResource: "self_signed_key", ofType: "pem")!
let key = try NIOSSLPrivateKey(file: keyPath, format: .pem)
let configuration = try TLSConfiguration.makeServerConfiguration(
certificateChain: NIOSSLCertificate.fromPEMFile(certPath).map { .certificate($0) },
privateKey: .file(keyPath)
privateKey: .privateKey(key)
)
let sslContext = try NIOSSLContext(configuration: configuration)

Expand Down Expand Up @@ -1314,9 +1315,10 @@ final class HTTPClientTests: XCTestCaseHTTPClientTestsBaseClass {
/// openssl req -x509 -newkey rsa:4096 -keyout self_signed_key.pem -out self_signed_cert.pem -sha256 -days 99999 -nodes -subj '/CN=localhost'
let certPath = Bundle.module.path(forResource: "self_signed_cert", ofType: "pem")!
let keyPath = Bundle.module.path(forResource: "self_signed_key", ofType: "pem")!
let key = try NIOSSLPrivateKey(file: keyPath, format: .pem)
let configuration = try TLSConfiguration.makeServerConfiguration(
certificateChain: NIOSSLCertificate.fromPEMFile(certPath).map { .certificate($0) },
privateKey: .file(keyPath)
privateKey: .privateKey(key)
)
let sslContext = try NIOSSLContext(configuration: configuration)

Expand Down