diff --git a/.gitignore b/.gitignore index f0a40d9..7d233f1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ DerivedData/ .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata .netrc .vscode +.devcontainer Package.resolved diff --git a/Tests/HummingbirdPostgresTests/JobsTests.swift b/Tests/HummingbirdPostgresTests/JobsTests.swift index 3c4bad2..9be42d8 100644 --- a/Tests/HummingbirdPostgresTests/JobsTests.swift +++ b/Tests/HummingbirdPostgresTests/JobsTests.swift @@ -77,7 +77,7 @@ final class JobsTests: XCTestCase { return try await withThrowingTaskGroup(of: Void.self) { group in let serviceGroup = ServiceGroup( configuration: .init( - services: [PostgresClientService(client: jobQueue.queue.client), jobQueue], + services: [jobQueue.queue.client, jobQueue], gracefulShutdownSignals: [.sigterm, .sigint], logger: jobQueue.queue.logger ) @@ -352,7 +352,7 @@ final class JobsTests: XCTestCase { try await withThrowingTaskGroup(of: Void.self) { group in let serviceGroup = ServiceGroup( configuration: .init( - services: [PostgresClientService(client: postgresClient), jobQueue, jobQueue2], + services: [postgresClient, jobQueue, jobQueue2], gracefulShutdownSignals: [.sigterm, .sigint], logger: logger ) diff --git a/Tests/HummingbirdPostgresTests/PersistTests.swift b/Tests/HummingbirdPostgresTests/PersistTests.swift index 005f2f6..18068cb 100644 --- a/Tests/HummingbirdPostgresTests/PersistTests.swift +++ b/Tests/HummingbirdPostgresTests/PersistTests.swift @@ -71,7 +71,7 @@ final class PersistTests: XCTestCase { } updateRouter(router, persist) var app = Application(responder: router.buildResponder()) - app.addServices(PostgresClientService(client: postgresClient), persist) + app.addServices(postgresClient, persist) app.runBeforeServerStart { try await postgresMigrations.apply(client: postgresClient, groups: [.persist], logger: logger, dryRun: false) } diff --git a/Tests/HummingbirdPostgresTests/TestUtils.swift b/Tests/HummingbirdPostgresTests/TestUtils.swift index 7415c9f..6d0b599 100644 --- a/Tests/HummingbirdPostgresTests/TestUtils.swift +++ b/Tests/HummingbirdPostgresTests/TestUtils.swift @@ -2,17 +2,6 @@ import Hummingbird import PostgresNIO import ServiceLifecycle -/// Manage the lifecycle of a PostgresClient -struct PostgresClientService: Service { - let client: PostgresClient - - func run() async { - await cancelOnGracefulShutdown { - await self.client.run() - } - } -} - func getPostgresConfiguration() async throws -> PostgresClient.Configuration { let env = try await Environment.shared.merging(with: .dotEnv()) return .init(