From 796644edda3eabf2ef23fd41475f9ba5ad0b27ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Fri, 23 Nov 2018 07:41:31 +0100 Subject: [PATCH] Fix test Concurrency is hard --- Tests/GRDBTests/ValueObservationReducerTests.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Tests/GRDBTests/ValueObservationReducerTests.swift b/Tests/GRDBTests/ValueObservationReducerTests.swift index cce9c0062..5c8974c64 100644 --- a/Tests/GRDBTests/ValueObservationReducerTests.swift +++ b/Tests/GRDBTests/ValueObservationReducerTests.swift @@ -39,7 +39,6 @@ class ValueObservationReducerTests: GRDBTestCase { notificationExpectation.expectedFulfillmentCount = 3 // A reducer which tracks its progress - var dropNext = false // if true, reducer drops next value let reducer = AnyValueReducer( fetch: { db -> Int in fetchCount += 1 @@ -48,9 +47,8 @@ class ValueObservationReducerTests: GRDBTestCase { }, value: { count -> String? in reduceCount += 1 - if dropNext { + if count == 3 { // test that reducer can drop values - dropNext = false return nil } // test that the fetched type and the notified type can be different @@ -95,7 +93,6 @@ class ValueObservationReducerTests: GRDBTestCase { } // Test a dropped transaction - dropNext = true try db.inTransaction { try db.execute("INSERT INTO t DEFAULT VALUES") try db.execute("INSERT INTO t DEFAULT VALUES") @@ -120,10 +117,6 @@ class ValueObservationReducerTests: GRDBTestCase { XCTAssertEqual(fetchCount, 4) XCTAssertEqual(reduceCount, 4) XCTAssertEqual(errors.count, 0) - // TODO: Fix flacky test: - // XCTAssertEqual failed: ("["0", "3", "5"]") is not equal to ("["0", "1", "5"]") - // - https://travis-ci.org/groue/GRDB.swift/jobs/458101713 - // - https://travis-ci.org/groue/GRDB.swift/jobs/458283461 XCTAssertEqual(changes, ["0", "1", "5"]) }