From 63a1bf8b05a9d8b4bbaee4db1cd4d5845e0ced59 Mon Sep 17 00:00:00 2001 From: Christian Noon Date: Wed, 2 May 2018 11:01:44 -0700 Subject: [PATCH] Updated the table lock policy test timings to attempt to stabilize CI. --- .../Tests/Database/TableLockPolicyTests.swift | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Tests/Tests/Database/TableLockPolicyTests.swift b/Tests/Tests/Database/TableLockPolicyTests.swift index b645d3f..199e2fe 100644 --- a/Tests/Tests/Database/TableLockPolicyTests.swift +++ b/Tests/Tests/Database/TableLockPolicyTests.swift @@ -54,7 +54,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { // When DispatchQueue.userInitiated.async { do { - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 10_000, connection: writeConnection) } catch { writeError = error } @@ -62,7 +62,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { writeExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.05) { do { readCount = try readConnection.query("SELECT count(*) FROM agents") } catch { @@ -99,7 +99,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { sharedCache: true ) - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) let writeExpectation = self.expectation(description: "Write should fail") let readExpectation = self.expectation(description: "Read should succeed") @@ -119,9 +119,9 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { readExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.1) { do { - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) } catch { writeError = error } @@ -132,7 +132,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { waitForExpectations(timeout: timeout, handler: nil) // Then - XCTAssertEqual(agents.count, 1_002) + XCTAssertEqual(agents.count, 5_002) XCTAssertNil(readError) XCTAssertNotNil(writeError) @@ -156,7 +156,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { sharedCache: true ) - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) let writeExpectation = self.expectation(description: "Write should fail") let readExpectation = self.expectation(description: "Read should succeed") @@ -176,7 +176,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { readExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.1) { do { let dateString = bindingDateFormatter.string(from: Date()) @@ -196,7 +196,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { waitForExpectations(timeout: timeout, handler: nil) // Then - XCTAssertEqual(agents.count, 1_002) + XCTAssertEqual(agents.count, 5_002) XCTAssertNil(readError) XCTAssertNotNil(writeError) @@ -232,7 +232,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { // When DispatchQueue.userInitiated.async { do { - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) } catch { writeError = error } @@ -240,7 +240,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { writeExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.1) { do { readCount = try readConnection.query("SELECT count(*) FROM agents") } catch { @@ -255,7 +255,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { // Then XCTAssertNil(writeError) XCTAssertNil(readError) - XCTAssertEqual(readCount, 1_002) + XCTAssertEqual(readCount, 5_002) } func testThatConnectionDoesNotThrowErrorWhenReadLockBlocksWriteLockWithTableLockPolicyEnabled() throws { @@ -273,7 +273,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { sharedCache: true ) - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) let writeExpectation = self.expectation(description: "Write should succeed") let readExpectation = self.expectation(description: "Read should succeed") @@ -293,9 +293,9 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { readExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.1) { do { - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) } catch { writeError = error } @@ -306,7 +306,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { waitForExpectations(timeout: timeout, handler: nil) // Then - XCTAssertEqual(agents.count, 1_002) + XCTAssertEqual(agents.count, 5_002) XCTAssertNil(readError) XCTAssertNil(writeError) } @@ -326,7 +326,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { sharedCache: true ) - try TestTables.insertDummyAgents(count: 1_000, connection: writeConnection) + try TestTables.insertDummyAgents(count: 5_000, connection: writeConnection) let writeExpectation = self.expectation(description: "Write should succeed") let readExpectation = self.expectation(description: "Read should succeed") @@ -346,7 +346,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { readExpectation.fulfill() } - DispatchQueue.userInitiated.asyncAfter(seconds: 0.01) { + DispatchQueue.userInitiated.asyncAfter(seconds: 0.1) { do { let dateString = bindingDateFormatter.string(from: Date()) @@ -366,7 +366,7 @@ class TableLockPolicyTestCase: BaseConnectionTestCase { waitForExpectations(timeout: timeout, handler: nil) // Then - XCTAssertEqual(agents.count, 1_002) + XCTAssertEqual(agents.count, 5_002) XCTAssertNil(readError) XCTAssertNil(writeError) }