From 6f3ec89bcd0dbb8404dc11830102ec108b100310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 7 Jun 2020 10:09:24 +0200 Subject: [PATCH] Update checkpointing tests --- Tests/GRDBTests/DatabasePoolConcurrencyTests.swift | 8 ++++---- Tests/GRDBTests/DatabaseSnapshotTests.swift | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift index 73e31caab..842da567e 100644 --- a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift +++ b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift @@ -442,8 +442,8 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { defer { s2.signal() } try dbPool.writeWithoutTransaction { db in try db.execute(sql: "DELETE FROM items") + try db.checkpoint() } - try dbPool.checkpoint() } catch { XCTFail("error: \(error)") } @@ -538,8 +538,8 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { defer { s2.signal() } try dbPool.writeWithoutTransaction { db in try db.execute(sql: "INSERT INTO items (id) VALUES (NULL)") + try db.checkpoint() } - try dbPool.checkpoint() } catch { XCTFail("error: \(error)") } @@ -759,8 +759,8 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { defer { s2.signal() } try dbPool.writeWithoutTransaction { db in try db.execute(sql: "DELETE FROM items") + try db.checkpoint() } - try dbPool.checkpoint() } catch { XCTFail("error: \(error)") } @@ -803,8 +803,8 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { defer { s2.signal() } try dbPool.writeWithoutTransaction { db in try db.execute(sql: "INSERT INTO items (id) VALUES (NULL)") + try db.checkpoint() } - try dbPool.checkpoint() } catch { XCTFail("error: \(error)") } diff --git a/Tests/GRDBTests/DatabaseSnapshotTests.swift b/Tests/GRDBTests/DatabaseSnapshotTests.swift index dc7bdb8e2..df3c8cb4a 100644 --- a/Tests/GRDBTests/DatabaseSnapshotTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotTests.swift @@ -270,7 +270,7 @@ class DatabaseSnapshotTests: GRDBTestCase { let counter = try Counter(dbPool: dbPool) try dbPool.write(counter.increment) let snapshot = try dbPool.makeSnapshot() - try? dbPool.checkpoint(.passive) // ignore if error or not, that's not the point + try? dbPool.writeWithoutTransaction { _ = try $0.checkpoint(.passive) } // ignore if error or not, that's not the point try XCTAssertEqual(snapshot.read(counter.value), 1) try dbPool.write(counter.increment) try XCTAssertEqual(snapshot.read(counter.value), 1) @@ -281,7 +281,7 @@ class DatabaseSnapshotTests: GRDBTestCase { let counter = try Counter(dbPool: dbPool) try dbPool.write(counter.increment) let snapshot = try dbPool.makeSnapshot() - try? dbPool.checkpoint(.full) // ignore if error or not, that's not the point + try? dbPool.writeWithoutTransaction { _ = try $0.checkpoint(.full) } // ignore if error or not, that's not the point try XCTAssertEqual(snapshot.read(counter.value), 1) try dbPool.write(counter.increment) try XCTAssertEqual(snapshot.read(counter.value), 1) @@ -292,7 +292,7 @@ class DatabaseSnapshotTests: GRDBTestCase { let counter = try Counter(dbPool: dbPool) try dbPool.write(counter.increment) let snapshot = try dbPool.makeSnapshot() - try? dbPool.checkpoint(.restart) // ignore if error or not, that's not the point + try? dbPool.writeWithoutTransaction { _ = try $0.checkpoint(.restart) } // ignore if error or not, that's not the point try XCTAssertEqual(snapshot.read(counter.value), 1) try dbPool.write(counter.increment) try XCTAssertEqual(snapshot.read(counter.value), 1) @@ -303,7 +303,7 @@ class DatabaseSnapshotTests: GRDBTestCase { let counter = try Counter(dbPool: dbPool) try dbPool.write(counter.increment) let snapshot = try dbPool.makeSnapshot() - try? dbPool.checkpoint(.truncate) // ignore if error or not, that's not the point + try? dbPool.writeWithoutTransaction { _ = try $0.checkpoint(.truncate) } // ignore if error or not, that's not the point try XCTAssertEqual(snapshot.read(counter.value), 1) try dbPool.write(counter.increment) try XCTAssertEqual(snapshot.read(counter.value), 1)