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 committed Apr 1, 2021
1 parent a61cc89 commit 5e1d990
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/ApolloWebsocketTests/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 5e1d990

Please sign in to comment.