From 99047f21a12aae723851ad8ad06b037acfbab015 Mon Sep 17 00:00:00 2001 From: MahdiBM Date: Tue, 21 May 2024 22:59:54 +0330 Subject: [PATCH] remove syncShutdown() s --- Sources/Penny/Penny.swift | 12 +++++------- Tests/PennyTests/Fake/FakeMainService.swift | 4 ---- Tests/PennyTests/Tests/GHHooksTests.swift | 4 ---- Tests/PennyTests/Tests/LeafRenderTests.swift | 4 ++-- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Sources/Penny/Penny.swift b/Sources/Penny/Penny.swift index a8c520c1..6f0269a9 100644 --- a/Sources/Penny/Penny.swift +++ b/Sources/Penny/Penny.swift @@ -18,13 +18,6 @@ struct Penny { ) let awsClient = AWSClient(httpClient: httpClient) - /// These shutdown calls are only useful for tests where we call `Penny.main()` repeatedly - defer { - /// Shutdown in reverse order of dependance. - try! awsClient.syncShutdown() - try! httpClient.syncShutdown() - } - try await mainService.bootstrapLoggingSystem(httpClient: httpClient) let bot = try await mainService.makeBot( @@ -46,5 +39,10 @@ struct Penny { for await event in await bot.events { EventHandler(event: event, context: context).handle() } + + /// These shutdown calls are only useful for tests where we call `Penny.main()` repeatedly + /// Shutdown in reverse order of dependance. + try! await awsClient.shutdown() + try! await httpClient.shutdown() } } diff --git a/Tests/PennyTests/Fake/FakeMainService.swift b/Tests/PennyTests/Fake/FakeMainService.swift index f28058ef..ae0c6024 100644 --- a/Tests/PennyTests/Fake/FakeMainService.swift +++ b/Tests/PennyTests/Fake/FakeMainService.swift @@ -38,10 +38,6 @@ actor FakeMainService: MainService { ) } - deinit { - try! httpClient.syncShutdown() - } - func bootstrapLoggingSystem(httpClient: HTTPClient) async throws { } func makeBot(httpClient: HTTPClient) async throws -> any GatewayManager { diff --git a/Tests/PennyTests/Tests/GHHooksTests.swift b/Tests/PennyTests/Tests/GHHooksTests.swift index 313b0398..74ed32dc 100644 --- a/Tests/PennyTests/Tests/GHHooksTests.swift +++ b/Tests/PennyTests/Tests/GHHooksTests.swift @@ -31,10 +31,6 @@ class GHHooksTests: XCTestCase { FakeResponseStorage.shared = FakeResponseStorage() } - override func tearDown() { - try! httpClient.syncShutdown() - } - func testUnicodesPrefix() throws { do { let scalars_16 = "Hello, world! 👍🏾" diff --git a/Tests/PennyTests/Tests/LeafRenderTests.swift b/Tests/PennyTests/Tests/LeafRenderTests.swift index c7414cb6..ae6280eb 100644 --- a/Tests/PennyTests/Tests/LeafRenderTests.swift +++ b/Tests/PennyTests/Tests/LeafRenderTests.swift @@ -34,8 +34,8 @@ class LeafRenderTests: XCTestCase { FakeResponseStorage.shared = FakeResponseStorage() } - override func tearDown() { - try! httpClient.syncShutdown() + override func tearDown() async throws { + try! await httpClient.shutdown() } func testTranslationNeededDescription() async throws {