From faecb6459dc464fb0b1306e3617518ccc1476b2b Mon Sep 17 00:00:00 2001 From: Paul Toffoloni Date: Wed, 28 Aug 2024 11:35:46 +0200 Subject: [PATCH] Merge again --- Sources/Queues/QueueWorker.swift | 1 + Sources/XCTQueues/TestQueueDriver.swift | 2 -- Tests/QueuesTests/AsyncQueueTests.swift | 1 - Tests/QueuesTests/MetricsTests.swift | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Sources/Queues/QueueWorker.swift b/Sources/Queues/QueueWorker.swift index 0ee02d6..d142a0c 100644 --- a/Sources/Queues/QueueWorker.swift +++ b/Sources/Queues/QueueWorker.swift @@ -1,3 +1,4 @@ + import Dispatch import Foundation import Logging diff --git a/Sources/XCTQueues/TestQueueDriver.swift b/Sources/XCTQueues/TestQueueDriver.swift index de6f335..613a6ce 100644 --- a/Sources/XCTQueues/TestQueueDriver.swift +++ b/Sources/XCTQueues/TestQueueDriver.swift @@ -110,7 +110,6 @@ extension Application.Queues { struct TestQueue: Queue { let _context: NIOLockedValueBox var context: QueueContext { self._context.withLockedValue { $0 } } - func get(_ id: JobIdentifier) -> EventLoopFuture { self._context.withLockedValue { context in context.eventLoop.makeSucceededFuture(context.application.queues.test.jobs[id]!) @@ -149,7 +148,6 @@ struct TestQueue: Queue { struct AsyncTestQueue: AsyncQueue { let _context: NIOLockedValueBox var context: QueueContext { self._context.withLockedValue { $0 } } - func get(_ id: JobIdentifier) async throws -> JobData { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id]! } } func set(_ id: JobIdentifier, to data: JobData) async throws { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id] = data } } func clear(_ id: JobIdentifier) async throws { self._context.withLockedValue { $0.application.queues.asyncTest.jobs[id] = nil } } diff --git a/Tests/QueuesTests/AsyncQueueTests.swift b/Tests/QueuesTests/AsyncQueueTests.swift index e1df95e..800fd59 100644 --- a/Tests/QueuesTests/AsyncQueueTests.swift +++ b/Tests/QueuesTests/AsyncQueueTests.swift @@ -16,7 +16,6 @@ func XCTAssertNoThrowAsync( final class AsyncQueueTests: XCTestCase { var app: Application! - override class func setUp() { XCTAssert(isLoggingConfigured) } diff --git a/Tests/QueuesTests/MetricsTests.swift b/Tests/QueuesTests/MetricsTests.swift index 019aeb5..f9dbdf4 100644 --- a/Tests/QueuesTests/MetricsTests.swift +++ b/Tests/QueuesTests/MetricsTests.swift @@ -79,7 +79,7 @@ final class MetricsTests: XCTestCase { XCTAssertEqual(self.app.queues.test.jobs.count, 0) XCTAssertEqual(dequeuedHook.successHit, true) - let counter = self.metrics.counters["success.completed.jobs.counter"] as! TestCounter + let counter = try XCTUnwrap(self.metrics.counters["success.completed.jobs.counter"] as? TestCounter) let queueNameDimension = try XCTUnwrap(counter.dimensions.first(where: { $0.0 == "queueName" })) XCTAssertEqual(queueNameDimension.1, self.app.queues.queue.queueName.string) try XCTAssertNoThrow(promise.futureResult.wait()) @@ -102,7 +102,7 @@ final class MetricsTests: XCTestCase { try self.app.queues.queue.worker.run().wait() - let counter = self.metrics.counters["dispatched.jobs.counter"] as! TestCounter + let counter = try XCTUnwrap(self.metrics.counters["dispatched.jobs.counter"] as? TestCounter) let queueNameDimension = try XCTUnwrap(counter.dimensions.first(where: { $0.0 == "queueName" })) XCTAssertEqual(queueNameDimension.1, self.app.queues.queue.queueName.string) try XCTAssertNoThrow(promise.futureResult.wait())