Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
afeick committed Oct 4, 2023
1 parent 349ddd7 commit 3f39bec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Tests/GRPCTests/ConnectionBackoffTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ConnectionBackoffTests: GRPCTestCase {
pow(self.backoff.initialBackoff * self.backoff.multiplier, Double(i)),
self.backoff.maximumBackoff
)
XCTAssertEqual(expected, backoff, accuracy: 1e-6)
XCTAssertEqual(expected, backoff!, accuracy: 1e-6)
}
}

Expand All @@ -55,7 +55,7 @@ class ConnectionBackoffTests: GRPCTestCase {
)
let halfJitterRange = self.backoff.jitter * unjittered
let jitteredRange = (unjittered - halfJitterRange) ... (unjittered + halfJitterRange)
XCTAssert(jitteredRange.contains(timeoutAndBackoff.backoff))
XCTAssert(jitteredRange.contains(timeoutAndBackoff.backoff!))
}
}

Expand All @@ -65,7 +65,7 @@ class ConnectionBackoffTests: GRPCTestCase {
self.backoff.jitter = 0.0

for backoff in self.backoff.prefix(100).map({ $0.backoff }) {
XCTAssertLessThanOrEqual(backoff, self.backoff.maximumBackoff)
XCTAssertLessThanOrEqual(backoff!, self.backoff.maximumBackoff)
}
}

Expand All @@ -79,19 +79,19 @@ class ConnectionBackoffTests: GRPCTestCase {
for limit in [1, 3, 5] {
let backoff = ConnectionBackoff(retries: .upTo(limit))
let values = Array(backoff)
XCTAssertEqual(values.count, limit)
XCTAssertEqual(values.count, limit+1)
}
}

func testConnectionBackoffWhenLimitedToZeroRetries() {
let backoff = ConnectionBackoff(retries: .upTo(0))
let values = Array(backoff)
XCTAssertTrue(values.isEmpty)
XCTAssertEqual(values.count, 1)
}

func testConnectionBackoffWithNoRetries() {
let backoff = ConnectionBackoff(retries: .none)
let values = Array(backoff)
XCTAssertTrue(values.isEmpty)
XCTAssertEqual(values.count, 1)
}
}

0 comments on commit 3f39bec

Please sign in to comment.