Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcairo committed Jan 16, 2025
1 parent 5ee2942 commit 4cf6048
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 25 deletions.
12 changes: 6 additions & 6 deletions Tests/GRPCNIOTransportHTTP2Tests/ControlService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ struct ControlService: RegistrableRPCService {
) { request, context in
return StreamingServerResponse { response in
let responseString = """
\(self.serverRemotePeerInfo(context: context))\n
\(self.serverLocalPeerInfo(context: context))\n
\(self.clientRemotePeerInfo(request: request))\n
\(self.clientLocalPeerInfo(request: request))
"""
\(self.serverRemotePeerInfo(context: context))\n
\(self.serverLocalPeerInfo(context: context))\n
\(self.clientRemotePeerInfo(request: request))\n
\(self.clientLocalPeerInfo(request: request))
"""

try await response.write(responseString)

Expand Down Expand Up @@ -294,7 +294,7 @@ struct PeerInfoClientInterceptor: ClientInterceptor {
StreamingClientRequest<Input>,
ClientContext
) async throws -> StreamingClientResponse<Output>
) async throws -> StreamingClientResponse<Output> where Input : Sendable, Output : Sendable {
) async throws -> StreamingClientResponse<Output> where Input: Sendable, Output: Sendable {
var request = request
request.metadata.addString(context.localPeer, forKey: "localPeer")
request.metadata.addString(context.remotePeer, forKey: "remotePeer")
Expand Down
52 changes: 33 additions & 19 deletions Tests/GRPCNIOTransportHTTP2Tests/HTTP2TransportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1640,21 +1640,25 @@ final class HTTP2TransportTests: XCTestCase {
}

let serverRemotePeer = addresses[0]
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(of: /Server's remote peer: ipv4:127.0.0.1:(\d+)/)
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(
of: /Server's remote peer: ipv4:127.0.0.1:(\d+)/
)
let clientPort = try XCTUnwrap(serverRemotePeerMatches).1

// TODO: Uncomment when server local peer info is implemented

// let serverLocalPeer = addresses[1]
// let serverLocalPeerMatches = serverLocalPeer.wholeMatch(of: /Server's local peer: <not yet implemented>/)
// let serverPort = XCTUnwrap(serverLocalPeerMatches).1
// let serverLocalPeer = addresses[1]
// let serverLocalPeerMatches = serverLocalPeer.wholeMatch(of: /Server's local peer: <not yet implemented>/)
// let serverPort = XCTUnwrap(serverLocalPeerMatches).1

// let clientRemotePeer = addresses[2]
// let clientRemotePeerMatches = clientRemotePeer.wholeMatch(of: /Client's remote peer: ipv4:127.0.0.1:(\d+)/)
// XCTAssertEqual(try XCTUnwrap(clientRemotePeerMatches).1, serverPort)
// let clientRemotePeer = addresses[2]
// let clientRemotePeerMatches = clientRemotePeer.wholeMatch(of: /Client's remote peer: ipv4:127.0.0.1:(\d+)/)
// XCTAssertEqual(try XCTUnwrap(clientRemotePeerMatches).1, serverPort)

let clientLocalPeer = addresses[3]
let clientLocalPeerMatches = clientLocalPeer.wholeMatch(of: /Client's local peer: ipv4:127.0.0.1:(\d+)/)
let clientLocalPeerMatches = clientLocalPeer.wholeMatch(
of: /Client's local peer: ipv4:127.0.0.1:(\d+)/
)
XCTAssertEqual(try XCTUnwrap(clientLocalPeerMatches).1, clientPort)
}
}
Expand All @@ -1672,21 +1676,25 @@ final class HTTP2TransportTests: XCTestCase {
}

let serverRemotePeer = addresses[0]
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(of: /Server's remote peer: ipv6:[::1]:(\d+)/)
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(
of: /Server's remote peer: ipv6:[::1]:(\d+)/
)
let clientPort = try XCTUnwrap(serverRemotePeerMatches).1

// TODO: Uncomment when server local peer info is implemented

// let serverLocalPeer = addresses[1]
// let serverLocalPeerMatches = serverLocalPeer.wholeMatch(of: /Server's local peer: <not yet implemented>/)
// let serverPort = XCTUnwrap(serverLocalPeerMatches).1
// let serverLocalPeer = addresses[1]
// let serverLocalPeerMatches = serverLocalPeer.wholeMatch(of: /Server's local peer: <not yet implemented>/)
// let serverPort = XCTUnwrap(serverLocalPeerMatches).1

// let clientRemotePeer = addresses[2]
// let clientRemotePeerMatches = clientRemotePeer.wholeMatch(of: /Client's remote peer: ipv6:[::1]:(\d+)/)
// XCTAssertEqual(try XCTUnwrap(clientRemotePeerMatches).1, serverPort)
// let clientRemotePeer = addresses[2]
// let clientRemotePeerMatches = clientRemotePeer.wholeMatch(of: /Client's remote peer: ipv6:[::1]:(\d+)/)
// XCTAssertEqual(try XCTUnwrap(clientRemotePeerMatches).1, serverPort)

let clientLocalPeer = addresses[3]
let clientLocalPeerMatches = clientLocalPeer.wholeMatch(of: /Client's local peer: ipv6:[::1]:(\d+)/)
let clientLocalPeerMatches = clientLocalPeer.wholeMatch(
of: /Client's local peer: ipv6:[::1]:(\d+)/
)
XCTAssertEqual(try XCTUnwrap(clientLocalPeerMatches).1, clientPort)
}
}
Expand All @@ -1705,15 +1713,21 @@ final class HTTP2TransportTests: XCTestCase {
}

let serverRemotePeer = addresses[0]
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(of: /Server's remote peer: unix:peer-info-uds/)
let serverRemotePeerMatches = serverRemotePeer.wholeMatch(
of: /Server's remote peer: unix:peer-info-uds/
)
XCTAssertNotNil(serverRemotePeerMatches)

let serverLocalPeer = addresses[1]
let serverLocalPeerMatches = serverLocalPeer.wholeMatch(of: /Server's local peer: <not yet implemented>/)
let serverLocalPeerMatches = serverLocalPeer.wholeMatch(
of: /Server's local peer: <not yet implemented>/
)
XCTAssertNotNil(serverLocalPeerMatches)

let clientRemotePeer = addresses[2]
let clientRemotePeerMatches = clientRemotePeer.wholeMatch(of: /Client's remote peer: unix:peer-info-uds/)
let clientRemotePeerMatches = clientRemotePeer.wholeMatch(
of: /Client's remote peer: unix:peer-info-uds/
)
XCTAssertNotNil(clientRemotePeerMatches)

let clientLocalPeer = addresses[3]
Expand Down

0 comments on commit 4cf6048

Please sign in to comment.