From 1746cd23d51a4a6391b27809796a7adc1153e263 Mon Sep 17 00:00:00 2001 From: Kyle Browning Date: Wed, 20 Nov 2019 11:05:35 -0800 Subject: [PATCH] fix address leaks in tests. (#61) * fix leaks in tests. * Disable leak detection for linux --- .github/workflows/swift.yml | 14 +++++++------- Tests/APNSwiftTests/APNSwiftRequestTests.swift | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 04a86ec6..4ef2e796 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -37,10 +37,10 @@ jobs: steps: - uses: actions/checkout@master - run: swift test --sanitize=thread - # address: - # container: - # image: vapor/swift:5.1-bionic - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@master - # - run: swift test --sanitize=address + address: + container: + image: vapor/swift:5.1-bionic + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - run: ASAN_OPTIONS=detect_leaks=0 swift test --sanitize=address diff --git a/Tests/APNSwiftTests/APNSwiftRequestTests.swift b/Tests/APNSwiftTests/APNSwiftRequestTests.swift index bb985fa0..00e1db99 100644 --- a/Tests/APNSwiftTests/APNSwiftRequestTests.swift +++ b/Tests/APNSwiftTests/APNSwiftRequestTests.swift @@ -222,6 +222,7 @@ final class APNSwiftRequestTests: XCTestCase { XCTFail("response should not success") } } + XCTAssertNoThrow(XCTAssertTrue(try channel.finish().isClean)) } func testTokenProviderUpdate() { @@ -261,6 +262,7 @@ final class APNSwiftRequestTests: XCTestCase { loop.advanceTime(by: .minutes(55)) // Should have changed XCTAssertFalse(newCachedToken == bearerToken.currentBearerToken) + bearerToken.cancel() } static var allTests = [