Fix flake AsyncEmbeddedEventLoopTest (#2147)

Motivation:

Flaky tests are really annoying.

Modifications:

- Stop assuming that the item is not immediately nil

Result:

Test now passes consistently.
This commit is contained in:
Cory Benfield 2022-06-01 11:44:59 +01:00 committed by GitHub
parent afbf7566d5
commit 32f62a89d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -499,10 +499,7 @@ final class NIOAsyncEmbeddedEventLoopTests: XCTestCase {
let scheduled = make()
scheduled.cancel()
XCTAssertNotNil(weakThing)
await eventLoop.run()
XCTAssertNil(weakThing)
assert(weakThing == nil, within: .seconds(1))
await XCTAssertThrowsError(try await eventLoop.awaitFuture(scheduled.futureResult, timeout: .seconds(1))) { error in
XCTAssertEqual(EventLoopError.cancelled, error as? EventLoopError)
}