Skip to content

Commit

Permalink
Added a test which triggers thread sanitizer error without the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Seppo Tomperi authored and designatednerd committed Apr 23, 2021
1 parent fcc26cc commit 69466ad
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/ApolloTests/WebSocket/WebSocketTransportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ class WebSocketTransportTests: XCTestCase {

waitForExpectations(timeout: 3, handler: nil)
}

func testCloseConnectionAndInit() {
WebSocketTransport.provider = MockWebSocket.self

self.webSocketTransport = WebSocketTransport(request: URLRequest(url: TestURL.mockServer.url),
connectingPayload: ["Authorization": "OldToken"])
self.webSocketTransport.closeConnection()
self.webSocketTransport.updateConnectingPayload(["Authorization": "UpdatedToken"])
self.webSocketTransport.initServer()

let exp = expectation(description: "Wait")
let result = XCTWaiter.wait(for: [exp], timeout: 1.0)
if result == XCTWaiter.Result.timedOut {
} else {
XCTFail("Delay interrupted")
}
}
}

private final class MockWebSocketDelegate: WebSocketDelegate {
Expand Down

0 comments on commit 69466ad

Please sign in to comment.