Skip to content

Commit

Permalink
WIP turn on debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
amnonbc committed Sep 18, 2024
1 parent b3db53d commit 1918cfd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Test/Tests/RealtimeClientConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,7 @@ class RealtimeClientConnectionTests: XCTestCase {
let test = Test()
let options = try AblyTests.commonAppSetup(for: test)
options.autoConnect = false
options.logLevel = .debug;
options.testOptions.transportFactory = TestProxyTransportFactory()
let tokenTtl = 3.0
let tokenDetails = try getTestTokenDetails(for: test, key: options.key, capability: nil, ttl: tokenTtl)
Expand Down Expand Up @@ -2136,17 +2137,18 @@ class RealtimeClientConnectionTests: XCTestCase {
let test = Test()
let options = try AblyTests.clientOptions(for: test)
options.autoConnect = false
options.logLevel = .debug;
let tokenTtl = 1.0
options.token = try getTestToken(for: test, ttl: tokenTtl)
options.testOptions.transportFactory = TestProxyTransportFactory()

// Let the token expire
waitUntil(timeout: testTimeout) { done in
delay(tokenTtl + AblyTests.tokenExpiryTolerance+10.0) {
delay(tokenTtl + AblyTests.tokenExpiryTolerance) {
done()
}
}

let client = ARTRealtime(options: options)
defer {
client.dispose()
Expand All @@ -2159,7 +2161,7 @@ class RealtimeClientConnectionTests: XCTestCase {
client.connection.on { stateChange in
let state = stateChange.current
let errorInfo = stateChange.reason
print("got state change state:")
print("got state change state: \(stateChange.current)")
print(stateChange.current)
switch state {
case .connected:
Expand All @@ -2169,6 +2171,7 @@ class RealtimeClientConnectionTests: XCTestCase {
guard let errorInfo = errorInfo else {
fail("ErrorInfo is nil"); done(); return
}
print("got errorInfo.code=\(errorInfo.code)")
XCTAssertEqual(errorInfo.code, ARTErrorCode.tokenExpired.intValue)
done()
default:
Expand All @@ -2181,8 +2184,9 @@ class RealtimeClientConnectionTests: XCTestCase {

let failures = transport.protocolMessagesReceived.filter { $0.action == .error }

print("failures.count=\(failures.count)")
if failures.count != 1 {
fail("Should have only one connection request fail")
fail("Should have only one connection request fail, got \(failures.count)")
return
}

Expand Down

0 comments on commit 1918cfd

Please sign in to comment.