Skip to content

Commit 67ecbf1

Browse files
thoven87adam-fowler
authored andcommitted
Update JobsTests.swift
1 parent 0a1607d commit 67ecbf1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Tests/JobsPostgresTests/JobsTests.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,11 +859,17 @@ final class JobsTests: XCTestCase {
859859
}
860860
let expectation = XCTestExpectation(description: "TestJob.execute was called", expectedFulfillmentCount: 3)
861861
try await self.testJobQueue(
862-
numWorkers: 1
862+
numWorkers: 1,
863+
configuration: .init(
864+
retentionPolicy: .init(
865+
cancelled: .retain(for: -1),
866+
completed: .retain(for: -1),
867+
failed: .retain(for: -1)
868+
)
869+
)
863870
) { jobQueue in
864871
jobQueue.registerJob(parameters: TestParameters.self) { parameters, context in
865872
context.logger.info("Parameters=\(parameters.value)")
866-
try await Task.sleep(for: .milliseconds(Int.random(in: 10..<50)))
867873
expectation.fulfill()
868874
}
869875
try await jobQueue.push(TestParameters(value: 1))
@@ -875,6 +881,8 @@ final class JobsTests: XCTestCase {
875881
let completedJobs = try await jobQueue.queue.getJobs(withStatus: .completed)
876882
XCTAssertEqual(completedJobs.count, 3)
877883
try await jobQueue.queue.processDataRetentionPolicy()
884+
let zeroJobs = try await jobQueue.queue.getJobs(withStatus: .completed)
885+
XCTAssertEqual(zeroJobs.count, 0)
878886
}
879887
}
880888
}

0 commit comments

Comments
 (0)