Skip to content

Commit

Permalink
Fix the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis committed Oct 25, 2023
1 parent 2da5000 commit 297eaff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Tests/MongoQueueTests/MongoQueueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ final class MongoQueueTests: XCTestCase {

@available(macOS 13.0, *)
func testMaxParallelJobs() async throws {
Self.ranTasks = 0
let db = try await MongoDatabase.connect(to: settings)
try await db.drop()
let queue = MongoQueue(collection: db["tasks"])
Expand All @@ -43,13 +44,14 @@ final class MongoQueueTests: XCTestCase {

try await queue.runUntilEmpty()

XCTAssertLessThanOrEqual(-start.timeIntervalSinceNow, 2)
XCTAssertLessThanOrEqual(Date().timeIntervalSince(start), 2)

XCTAssertEqual(Self.ranTasks, 6)
}

@available(macOS 13.0, *)
func testMaxParallelJobsLow() async throws {
Self.ranTasks = 0
let db = try await MongoDatabase.connect(to: settings)
try await db.drop()
let queue = MongoQueue(collection: db["tasks"])
Expand All @@ -67,7 +69,7 @@ final class MongoQueueTests: XCTestCase {

try await queue.runUntilEmpty()

XCTAssertGreaterThanOrEqual(-start.timeIntervalSinceNow, 6)
XCTAssertLessThanOrEqual(Date().timeIntervalSince(start), 7)

XCTAssertEqual(Self.ranTasks, 6)
}
Expand Down

0 comments on commit 297eaff

Please sign in to comment.