From 4c1bd147bb291cf1acd20fc04772a7fa1d0c453f Mon Sep 17 00:00:00 2001 From: Antonio Barcelos Date: Tue, 15 Dec 2020 12:07:45 +0100 Subject: [PATCH] test: Improve the test timeout definition The timeout was being defined using the jasmine global variable and it was causing some flakyness in the tests. --- test/bolt-v3.test.js | 232 +++--- test/bolt-v4x0.test.js | 24 +- test/examples.test.js | 57 +- .../connection-provider-routing.test.js | 98 ++- .../node/direct.driver.boltkit.test.js | 107 ++- .../node/node-host-name-resolver.test.js | 24 +- .../node/routing.driver.boltkit.test.js | 677 +++++++++++------- test/internal/transaction-executor.test.js | 70 +- test/nested-statements.test.js | 10 +- test/rx/navigation.test.js | 317 +++++--- test/rx/session.test.js | 18 +- test/session.test.js | 160 +++-- test/stress.test.js | 5 - test/temporal-types.test.js | 164 ++--- test/transaction.test.js | 81 +-- test/types.test.js | 22 +- 16 files changed, 1139 insertions(+), 927 deletions(-) diff --git a/test/bolt-v3.test.js b/test/bolt-v3.test.js index 916078e90..71ce68544 100644 --- a/test/bolt-v3.test.js +++ b/test/bolt-v3.test.js @@ -34,7 +34,6 @@ describe('#integration Bolt V3 API', () => { let driver let session let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -42,14 +41,11 @@ describe('#integration Bolt V3 API', () => { sharedNeo4j.authToken ) session = driver.session() - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000 protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver) }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await session.close() await driver.close() }) @@ -73,7 +69,7 @@ describe('#integration Bolt V3 API', () => { ) const receivedMetadatas = result.records.map(r => r.get('metaData')) expect(receivedMetadatas).toContain(metadata) - }) + }, 20000) it('should set transaction timeout for auto-commit transaction', async () => { if (!databaseSupportsBoltV3()) { @@ -104,47 +100,77 @@ describe('#integration Bolt V3 API', () => { } await tx.rollback() await otherSession.close() - }) - - it('should set transaction metadata with read transaction function', () => - testTransactionMetadataWithTransactionFunctions(true)) - - it('should set transaction metadata with write transaction function', () => - testTransactionMetadataWithTransactionFunctions(false)) - - it('should fail auto-commit transaction with metadata when database does not support Bolt V3', () => - testAutoCommitTransactionConfigWhenBoltV3NotSupported( - TX_CONFIG_WITH_METADATA - )) - - it('should fail auto-commit transaction with timeout when database does not support Bolt V3', () => - testAutoCommitTransactionConfigWhenBoltV3NotSupported( - TX_CONFIG_WITH_TIMEOUT - )) - - it('should fail read transaction function with metadata when database does not support Bolt V3', () => - testTransactionFunctionConfigWhenBoltV3NotSupported( - true, - TX_CONFIG_WITH_METADATA - )) - - it('should fail read transaction function with timeout when database does not support Bolt V3', () => - testTransactionFunctionConfigWhenBoltV3NotSupported( - true, - TX_CONFIG_WITH_TIMEOUT - )) - - it('should fail write transaction function with metadata when database does not support Bolt V3', () => - testTransactionFunctionConfigWhenBoltV3NotSupported( - false, - TX_CONFIG_WITH_METADATA - )) - - it('should fail write transaction function with timeout when database does not support Bolt V3', () => - testTransactionFunctionConfigWhenBoltV3NotSupported( - false, - TX_CONFIG_WITH_TIMEOUT - )) + }, 20000) + + it( + 'should set transaction metadata with read transaction function', + () => testTransactionMetadataWithTransactionFunctions(true), + 20000 + ) + + it( + 'should set transaction metadata with write transaction function', + () => testTransactionMetadataWithTransactionFunctions(false), + 20000 + ) + + it( + 'should fail auto-commit transaction with metadata when database does not support Bolt V3', + () => + testAutoCommitTransactionConfigWhenBoltV3NotSupported( + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail auto-commit transaction with timeout when database does not support Bolt V3', + () => + testAutoCommitTransactionConfigWhenBoltV3NotSupported( + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) + + it( + 'should fail read transaction function with metadata when database does not support Bolt V3', + () => + testTransactionFunctionConfigWhenBoltV3NotSupported( + true, + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail read transaction function with timeout when database does not support Bolt V3', + () => + testTransactionFunctionConfigWhenBoltV3NotSupported( + true, + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) + + it( + 'should fail write transaction function with metadata when database does not support Bolt V3', + () => + testTransactionFunctionConfigWhenBoltV3NotSupported( + false, + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail write transaction function with timeout when database does not support Bolt V3', + () => + testTransactionFunctionConfigWhenBoltV3NotSupported( + false, + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) it('should set transaction metadata for explicit transactions', async () => { if (!databaseSupportsBoltV3() || !databaseSupportsListTransaction()) { @@ -165,7 +191,7 @@ describe('#integration Bolt V3 API', () => { expect(receivedMetadatas).toContain(metadata) await tx.commit() - }) + }, 20000) it('should set transaction timeout for explicit transactions', async () => { if (!databaseSupportsBoltV3()) { @@ -198,41 +224,65 @@ describe('#integration Bolt V3 API', () => { await otherTx.rollback() await otherSession.close() - }) - - it('should fail to run in explicit transaction with metadata when database does not support Bolt V3', () => - testRunInExplicitTransactionWithConfigWhenBoltV3NotSupported( - TX_CONFIG_WITH_METADATA - )) - - it('should fail to run in explicit transaction with timeout when database does not support Bolt V3', () => - testRunInExplicitTransactionWithConfigWhenBoltV3NotSupported( - TX_CONFIG_WITH_TIMEOUT - )) - - it('should fail to commit explicit transaction with metadata when database does not support Bolt V3', () => - testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( - true, - TX_CONFIG_WITH_METADATA - )) - - it('should fail to commit explicit transaction with timeout when database does not support Bolt V3', () => - testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( - true, - TX_CONFIG_WITH_TIMEOUT - )) - - it('should fail to rollback explicit transaction with metadata when database does not support Bolt V3', () => - testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( - false, - TX_CONFIG_WITH_METADATA - )) - - it('should fail to rollback explicit transaction with timeout when database does not support Bolt V3', () => - testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( - false, - TX_CONFIG_WITH_TIMEOUT - )) + }, 20000) + + it( + 'should fail to run in explicit transaction with metadata when database does not support Bolt V3', + () => + testRunInExplicitTransactionWithConfigWhenBoltV3NotSupported( + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail to run in explicit transaction with timeout when database does not support Bolt V3', + () => + testRunInExplicitTransactionWithConfigWhenBoltV3NotSupported( + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) + + it( + 'should fail to commit explicit transaction with metadata when database does not support Bolt V3', + () => + testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( + true, + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail to commit explicit transaction with timeout when database does not support Bolt V3', + () => + testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( + true, + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) + + it( + 'should fail to rollback explicit transaction with metadata when database does not support Bolt V3', + () => + testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( + false, + TX_CONFIG_WITH_METADATA + ), + 20000 + ) + + it( + 'should fail to rollback explicit transaction with timeout when database does not support Bolt V3', + () => + testCloseExplicitTransactionWithConfigWhenBoltV3NotSupported( + false, + TX_CONFIG_WITH_TIMEOUT + ), + 20000 + ) it('should fail to run auto-commit transaction with invalid timeout', () => { INVALID_TIMEOUT_VALUES.forEach(invalidValue => @@ -240,7 +290,7 @@ describe('#integration Bolt V3 API', () => { session.run('RETURN $x', { x: 42 }, { timeout: invalidValue }) ).toThrow() ) - }) + }, 20000) it('should fail to run auto-commit transaction with invalid metadata', () => { INVALID_METADATA_VALUES.forEach(invalidValue => @@ -248,7 +298,7 @@ describe('#integration Bolt V3 API', () => { session.run('RETURN $x', { x: 42 }, { metadata: invalidValue }) ).toThrow() ) - }) + }, 20000) it('should fail to begin explicit transaction with invalid timeout', () => { INVALID_TIMEOUT_VALUES.forEach(invalidValue => @@ -256,7 +306,7 @@ describe('#integration Bolt V3 API', () => { session.beginTransaction({ timeout: invalidValue }) ).toThrow() ) - }) + }, 20000) it('should fail to begin explicit transaction with invalid metadata', () => { INVALID_METADATA_VALUES.forEach(invalidValue => @@ -274,7 +324,7 @@ describe('#integration Bolt V3 API', () => { }) ).toThrow() ) - }) + }, 20000) it('should fail to run read transaction function with invalid metadata', () => { INVALID_METADATA_VALUES.forEach(invalidValue => @@ -294,7 +344,7 @@ describe('#integration Bolt V3 API', () => { }) ).toThrow() ) - }) + }, 20000) it('should fail to run write transaction function with invalid metadata', () => { INVALID_METADATA_VALUES.forEach(invalidValue => @@ -304,7 +354,7 @@ describe('#integration Bolt V3 API', () => { }) ).toThrow() ) - }) + }, 20000) it('should use bookmarks for auto commit transactions', async () => { if (!databaseSupportsBoltV3()) { @@ -333,7 +383,7 @@ describe('#integration Bolt V3 API', () => { expect(bookmark3).not.toEqual(initialBookmark) expect(bookmark3).not.toEqual(bookmark1) expect(bookmark3).not.toEqual(bookmark2) - }) + }, 20000) it('should use bookmarks for auto commit and explicit transactions', async () => { if (!databaseSupportsBoltV3()) { @@ -366,7 +416,7 @@ describe('#integration Bolt V3 API', () => { expect(bookmark3).not.toEqual(initialBookmark) expect(bookmark3).not.toEqual(bookmark1) expect(bookmark3).not.toEqual(bookmark2) - }) + }, 20000) it('should use bookmarks for auto commit transactions and transaction functions', async () => { if (!databaseSupportsBoltV3()) { @@ -395,7 +445,7 @@ describe('#integration Bolt V3 API', () => { expect(bookmark3).not.toEqual(initialBookmark) expect(bookmark3).not.toEqual(bookmark1) expect(bookmark3).not.toEqual(bookmark2) - }) + }, 20000) async function testTransactionMetadataWithTransactionFunctions (read) { if (!databaseSupportsBoltV3() || !databaseSupportsListTransaction()) { diff --git a/test/bolt-v4x0.test.js b/test/bolt-v4x0.test.js index 99f2a5442..bd2bb6f60 100644 --- a/test/bolt-v4x0.test.js +++ b/test/bolt-v4x0.test.js @@ -24,7 +24,6 @@ describe('#integration Bolt V4.0 API', () => { let driver let session let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -32,14 +31,11 @@ describe('#integration Bolt V4.0 API', () => { sharedNeo4j.authToken ) session = driver.session() - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000 protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver) }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await session.close() await driver.close() }) @@ -61,7 +57,7 @@ describe('#integration Bolt V4.0 API', () => { expectBoltV4NotSupportedError(error) done() }) - }) + }, 20000) it('should fail beginTransaction if not supported', done => { if (databaseSupportsBoltV4()) { @@ -78,7 +74,7 @@ describe('#integration Bolt V4.0 API', () => { expectBoltV4NotSupportedError(error) done() }) - }) + }, 20000) it('should fail readTransaction if not supported', done => { if (databaseSupportsBoltV4()) { @@ -95,7 +91,7 @@ describe('#integration Bolt V4.0 API', () => { expectBoltV4NotSupportedError(error) done() }) - }) + }, 20000) it('should fail writeTransaction if not supported', done => { if (databaseSupportsBoltV4()) { @@ -112,7 +108,7 @@ describe('#integration Bolt V4.0 API', () => { expectBoltV4NotSupportedError(error) done() }) - }) + }, 20000) it('should return database.name as null in result summary', async () => { if (databaseSupportsBoltV4()) { @@ -124,7 +120,7 @@ describe('#integration Bolt V4.0 API', () => { expect(result.summary.database).toBeTruthy() expect(result.summary.database.name).toBeNull() - }) + }, 20000) }) it('should fail if connecting to a non-existing database', async () => { @@ -143,18 +139,18 @@ describe('#integration Bolt V4.0 API', () => { } finally { await neoSession.close() } - }) + }, 20000) describe('default database', function () { it('should return database name in summary', async () => { await testDatabaseNameInSummary(null) - }) + }, 20000) }) describe('neo4j database', () => { it('should return database name in summary', async () => { await testDatabaseNameInSummary('neo4j') - }) + }, 20000) it('should be able to create a node', async () => { if (!databaseSupportsBoltV4()) { @@ -174,7 +170,7 @@ describe('#integration Bolt V4.0 API', () => { } finally { await neoSession.close() } - }) + }, 20000) it('should be able to connect single instance using neo4j scheme', async () => { if (!databaseSupportsBoltV4()) { @@ -199,7 +195,7 @@ describe('#integration Bolt V4.0 API', () => { await neoSession.close() await neoDriver.close() } - }) + }, 20000) }) }) diff --git a/test/examples.test.js b/test/examples.test.js index 0dc79d25a..6abc85768 100644 --- a/test/examples.test.js +++ b/test/examples.test.js @@ -37,7 +37,6 @@ describe('#integration examples', () => { let driverGlobal let protocolVersion let edition - let originalTimeout let consoleOverride let consoleOverridePromise @@ -48,9 +47,6 @@ describe('#integration examples', () => { const uri = `bolt://${sharedNeo4j.hostname}:7687` beforeAll(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - driverGlobal = neo4j.driver(uri, sharedNeo4j.authToken) }) @@ -67,7 +63,6 @@ describe('#integration examples', () => { }) afterAll(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await driverGlobal.close() }) @@ -114,7 +109,7 @@ describe('#integration examples', () => { const titles = await readProductTitles() expect(titles.length).toEqual(1) expect(titles[0]).toEqual('Product-0') - }) + }, 60000) it('rx autocommit transaction example', async () => { if (protocolVersion < 4.0) { @@ -154,7 +149,7 @@ describe('#integration examples', () => { Notification.createNext('Product-0'), Notification.createComplete() ]) - }) + }, 60000) it('basic auth example', async () => { // tag::basic-auth[] @@ -163,7 +158,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) it('config connection pool example', async () => { // tag::config-connection-pool[] @@ -176,7 +171,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) it('config connection timeout example', async () => { // tag::config-connection-timeout[] @@ -187,7 +182,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) it('config max retry time example', async () => { // tag::config-max-retry-time[] @@ -199,7 +194,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) /// TODO: re-enable it xit('config trust example', async () => { @@ -212,7 +207,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) it('config unencrypted example', async () => { // tag::config-unencrypted[] @@ -223,7 +218,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) /* eslint-disable no-unused-vars */ it('config custom resolver example', done => { @@ -250,7 +245,7 @@ describe('#integration examples', () => { // end::config-custom-resolver[] done() - }) + }, 60000) /* eslint-enable no-unused-vars */ it('custom auth example', async () => { @@ -269,7 +264,7 @@ describe('#integration examples', () => { await driver.verifyConnectivity() await driver.close() - }) + }, 60000) it('kerberos auth example', async () => { const ticket = 'a base64 encoded ticket' @@ -279,7 +274,7 @@ describe('#integration examples', () => { // end::kerberos-auth[] await driver.close() - }) + }, 60000) it('cypher error example', async () => { const console = consoleOverride @@ -307,7 +302,7 @@ describe('#integration examples', () => { .toLowerCase() .startsWith('invalid input') ).toBeTruthy() - }) + }, 60000) it('driver lifecycle example', async () => { const console = consoleOverride @@ -337,7 +332,7 @@ describe('#integration examples', () => { // end::driver-lifecycle[] expect(await consoleLoggedMsg).toEqual('Driver created') - }) + }, 60000) it('hello world example', async () => { const console = consoleOverride @@ -367,7 +362,7 @@ describe('#integration examples', () => { // end::hello-world[] expect(await consoleLoggedMsg).toContain('hello, world, from node') - }) + }, 60000) const require = () => { return neo4j @@ -402,7 +397,7 @@ describe('#integration examples', () => { // end::language-guide-page[] expect(await consoleLoggedMsg).toEqual(personName) - }) + }, 60000) it('driver introduction example', async () => { const console = consoleOverride @@ -469,7 +464,7 @@ describe('#integration examples', () => { expect(await consoleLoggedMsg).toEqual( `Created friendship between: ${person1Name}, ${person2Name}` ) - }) + }, 60000) it('read write transaction example', async () => { const console = consoleOverride @@ -501,7 +496,7 @@ describe('#integration examples', () => { // end::read-write-transaction[] expect(await consoleLoggedMsg).toContain('Matched created node with id') - }) + }, 60000) // tag::result-consume[] // Not supported @@ -542,7 +537,7 @@ describe('#integration examples', () => { // end::async-result-consume[] expect(await consoleLoggedMsg).toEqual('Names: Alice, Bob') - }) + }, 60000) it('rx result consume example', async () => { if (protocolVersion < 4.0) { @@ -579,7 +574,7 @@ describe('#integration examples', () => { Notification.createNext('Bob'), Notification.createComplete() ]) - }) + }, 60000) // tag::result-retain[] // Not supported @@ -629,7 +624,7 @@ describe('#integration examples', () => { } expect(await consoleLoggedMsg).toEqual('Created 2 employees') - }) + }, 60000) it('service unavailable example', done => { const console = consoleOverride @@ -662,7 +657,7 @@ describe('#integration examples', () => { }) .then(() => driver.close()) .then(() => done()) - }) + }, 60000) it('session example', async () => { const console = consoleOverride @@ -682,7 +677,7 @@ describe('#integration examples', () => { // end::session[] expect(await consoleLoggedMsg).toBe('Person created, session closed') - }) + }, 60000) // tag::transaction-function[] // Not supported @@ -720,7 +715,7 @@ describe('#integration examples', () => { expect(titles.length).toEqual(2) expect(titles.includes('Infinity Gauntlet')).toBeTruthy() expect(titles.includes('Mjölnir')).toBeTruthy() - }) + }, 60000) it('rx transaction function example', async () => { if (protocolVersion < 4.0) { @@ -758,7 +753,7 @@ describe('#integration examples', () => { Notification.createNext('Mjölnir'), Notification.createComplete() ]) - }) + }, 60000) it('use another database example', async () => { if (protocolVersion < 4.0 || edition !== 'enterprise') { @@ -818,7 +813,7 @@ describe('#integration examples', () => { // end::database-selection[] expect(await consoleLoggedMsg).toContain('Hello, Example-Database') - }) + }, 60000) it('pass bookmarks example', done => { const driver = driverGlobal @@ -925,7 +920,7 @@ describe('#integration examples', () => { done() }) - }) + }, 60000) }) function removeLineBreaks (string) { diff --git a/test/internal/connection-provider-routing.test.js b/test/internal/connection-provider-routing.test.js index 78dbdd532..ca29eb941 100644 --- a/test/internal/connection-provider-routing.test.js +++ b/test/internal/connection-provider-routing.test.js @@ -32,16 +32,6 @@ import DelegateConnection from '../../src/internal/connection-delegate' import { Neo4jError } from '../../src' describe('#unit RoutingConnectionProvider', () => { - let originalTimeout - beforeEach(function () { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000 - }) - - afterEach(function () { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - const server0 = ServerAddress.fromUrl('server0') const server1 = ServerAddress.fromUrl('server1') const server2 = ServerAddress.fromUrl('server2') @@ -91,7 +81,7 @@ describe('#unit RoutingConnectionProvider', () => { [server3], [server4] ) - }) + }, 10000) it('can not forget unknown address', () => { const connectionProvider = newRoutingConnectionProvider([ @@ -112,7 +102,7 @@ describe('#unit RoutingConnectionProvider', () => { [server3, server4], [server5, server6] ) - }) + }, 10000) it('purges connections when address is forgotten', () => { const pool = newPool() @@ -139,7 +129,7 @@ describe('#unit RoutingConnectionProvider', () => { expectPoolToContain(pool, [server3]) expectPoolToNotContain(pool, [server1, server5]) - }) + }, 10000) it('can forget writer address', () => { const connectionProvider = newRoutingConnectionProvider([ @@ -160,7 +150,7 @@ describe('#unit RoutingConnectionProvider', () => { [server3, server2], [server4] ) - }) + }, 10000) it('can not forget unknown writer address', () => { const connectionProvider = newRoutingConnectionProvider([ @@ -181,7 +171,7 @@ describe('#unit RoutingConnectionProvider', () => { [server3, server4], [server5, server6] ) - }) + }, 10000) it('acquires connection and returns a DelegateConnection', async () => { const pool = newPool() @@ -208,7 +198,7 @@ describe('#unit RoutingConnectionProvider', () => { database: null }) expect(conn2 instanceof DelegateConnection).toBeTruthy() - }) + }, 10000) it('acquires read connection with up-to-date routing table', done => { const pool = newPool() @@ -239,7 +229,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('acquires write connection with up-to-date routing table', done => { const pool = newPool() @@ -270,7 +260,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('throws for illegal access mode', done => { const connectionProvider = newRoutingConnectionProvider([ @@ -288,7 +278,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.message).toEqual('Illegal mode WRONG') done() }) - }) + }, 10000) it('refreshes stale routing table to get read connection', done => { const pool = newPool() @@ -327,7 +317,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('refreshes stale routing table to get write connection', done => { const pool = newPool() @@ -366,7 +356,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('refreshes stale routing table to get read connection when one router fails', done => { const pool = newPool() @@ -410,7 +400,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('refreshes stale routing table to get write connection when one router fails', done => { const pool = newPool() @@ -454,7 +444,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('refreshes routing table without readers to get read connection', done => { const pool = newPool() @@ -498,7 +488,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('refreshes routing table without writers to get write connection', done => { const pool = newPool() @@ -542,7 +532,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('throws when all routers return nothing while getting read connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -570,7 +560,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SERVICE_UNAVAILABLE) done() }) - }) + }, 10000) it('throws when all routers return nothing while getting write connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -598,7 +588,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SERVICE_UNAVAILABLE) done() }) - }) + }, 10000) it('throws when all routers return routing tables without readers while getting read connection', done => { const updatedRoutingTable = newRoutingTable( @@ -632,7 +622,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SESSION_EXPIRED) done() }) - }) + }, 10000) it('throws when all routers return routing tables without writers while getting write connection', done => { const updatedRoutingTable = newRoutingTable( @@ -666,7 +656,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SESSION_EXPIRED) done() }) - }) + }, 10000) it('throws when stale routing table without routers while getting read connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -688,7 +678,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SERVICE_UNAVAILABLE) done() }) - }) + }, 10000) it('throws when stale routing table without routers while getting write connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -710,7 +700,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SERVICE_UNAVAILABLE) done() }) - }) + }, 10000) it('updates routing table after refresh', done => { const pool = newPool() @@ -758,7 +748,7 @@ describe('#unit RoutingConnectionProvider', () => { ]) done() }) - }) + }, 10000) it('forgets all routers when they fail while acquiring read connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -787,7 +777,7 @@ describe('#unit RoutingConnectionProvider', () => { ) done() }) - }) + }, 10000) it('forgets all routers when they fail while acquiring write connection', done => { const connectionProvider = newRoutingConnectionProvider( @@ -816,7 +806,7 @@ describe('#unit RoutingConnectionProvider', () => { ) done() }) - }) + }, 10000) it('uses seed router address when all existing routers fail', done => { const updatedRoutingTable = newRoutingTable( @@ -868,7 +858,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('uses resolved seed router address when all existing routers fail', done => { const updatedRoutingTable = newRoutingTable( @@ -920,7 +910,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('uses resolved seed router address that returns correct routing table when all existing routers fail', done => { const updatedRoutingTable = newRoutingTable( @@ -972,7 +962,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('fails when both existing routers and seed router fail to return a routing table', done => { const connectionProvider = newRoutingConnectionProviderWithSeedRouter( @@ -1026,7 +1016,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('fails when both existing routers and resolved seed router fail to return a routing table', done => { const connectionProvider = newRoutingConnectionProviderWithSeedRouter( @@ -1079,7 +1069,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('fails when both existing routers and all resolved seed routers fail to return a routing table', done => { const connectionProvider = newRoutingConnectionProviderWithSeedRouter( @@ -1134,7 +1124,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('uses seed router when no existing routers', done => { const updatedRoutingTable = newRoutingTable( @@ -1183,7 +1173,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('uses resolved seed router when no existing routers', done => { const updatedRoutingTable = newRoutingTable( @@ -1232,7 +1222,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('uses resolved seed router that returns routing table when no existing routers exist', done => { const updatedRoutingTable = newRoutingTable( @@ -1283,7 +1273,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('ignores already probed routers after seed router resolution', done => { const updatedRoutingTable = newRoutingTable( @@ -1350,7 +1340,7 @@ describe('#unit RoutingConnectionProvider', () => { done() }) }) - }) + }, 10000) it('throws session expired when refreshed routing table has no readers', done => { const pool = newPool() @@ -1384,7 +1374,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SESSION_EXPIRED) done() }) - }) + }, 10000) it('throws session expired when refreshed routing table has no writers', done => { const pool = newPool() @@ -1418,7 +1408,7 @@ describe('#unit RoutingConnectionProvider', () => { expect(error.code).toEqual(SESSION_EXPIRED) done() }) - }) + }, 10000) it('should use resolved seed router after accepting table with no writers', done => { const routingTable1 = newRoutingTable( @@ -1494,7 +1484,7 @@ describe('#unit RoutingConnectionProvider', () => { }) }) }) - }) + }, 10000) describe('multi-database', () => { it('should acquire read connection from correct routing table', async () => { @@ -1525,7 +1515,7 @@ describe('#unit RoutingConnectionProvider', () => { }) expect(conn2 instanceof DelegateConnection).toBeTruthy() expect(conn2.address).toBe(serverA) - }) + }, 10000) it('should acquire write connection from correct routing table', async () => { const pool = newPool() @@ -1555,7 +1545,7 @@ describe('#unit RoutingConnectionProvider', () => { }) expect(conn2 instanceof DelegateConnection).toBeTruthy() expect(conn2.address).toBe(serverB) - }) + }, 10000) it('should fail connection acquisition if database is not known', async () => { const pool = newPool() @@ -1581,7 +1571,7 @@ describe('#unit RoutingConnectionProvider', () => { } expect(false).toBeTruthy('exception expected') - }) + }, 10000) it('should forget read server from correct routing table on availability error', async () => { const pool = newPool() @@ -1628,7 +1618,7 @@ describe('#unit RoutingConnectionProvider', () => { [serverB], [serverC] ) - }) + }, 10000) it('should forget write server from correct routing table on availability error', async () => { const pool = newPool() @@ -1675,7 +1665,7 @@ describe('#unit RoutingConnectionProvider', () => { [serverB], [serverC] ) - }) + }, 10000) it('should forget write server from the default database routing table on availability error', async () => { const pool = newPool() @@ -1815,7 +1805,7 @@ describe('#unit RoutingConnectionProvider', () => { [serverA, serverB], [serverC] ) - }) + }, 10000) it('should purge expired routing tables after specified duration on update', async () => { var originalDateNow = Date.now @@ -1901,7 +1891,7 @@ describe('#unit RoutingConnectionProvider', () => { } finally { Date.now = originalDateNow } - }) + }, 10000) }) }) diff --git a/test/internal/node/direct.driver.boltkit.test.js b/test/internal/node/direct.driver.boltkit.test.js index 5b2af24fc..e9e6d8113 100644 --- a/test/internal/node/direct.driver.boltkit.test.js +++ b/test/internal/node/direct.driver.boltkit.test.js @@ -23,17 +23,6 @@ import boltStub from '../bolt-stub' import { newError, SERVICE_UNAVAILABLE } from '../../../src/error' describe('#stub-direct direct driver with stub server', () => { - let originalTimeout - - beforeAll(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - }) - - afterAll(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - describe('should run query', () => { async function verifyShouldRunQuery (version) { if (!boltStub.supported) { @@ -58,11 +47,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyShouldRunQuery('v3')) + it('v3', () => verifyShouldRunQuery('v3'), 60000) - it('v4', () => verifyShouldRunQuery('v4')) + it('v4', () => verifyShouldRunQuery('v4'), 60000) - it('v4.2', () => verifyShouldRunQuery('v4.2')) + it('v4.2', () => verifyShouldRunQuery('v4.2'), 60000) }) it('should use custom user agent', async () => { @@ -80,7 +69,7 @@ describe('#stub-direct direct driver with stub server', () => { await session.run('MATCH (n) RETURN n.name') await driver.close() await server.exit() - }) + }, 60000) describe('should not send any routing with hello to disable server routing', () => { async function verify (version) { @@ -102,9 +91,9 @@ describe('#stub-direct direct driver with stub server', () => { await router.exit() } - it('v4.1', () => verify('v4.1')) + it('v4.1', () => verify('v4.1'), 60000) - it('v4.2', () => verify('v4.2')) + it('v4.2', () => verify('v4.2'), 60000) }) describe('should send and receive bookmark for read transaction', () => { @@ -138,11 +127,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyBookmarkForReadTxc('v3')) + it('v3', () => verifyBookmarkForReadTxc('v3'), 60000) - it('v4', () => verifyBookmarkForReadTxc('v4')) + it('v4', () => verifyBookmarkForReadTxc('v4'), 60000) - it('v4.2', () => verifyBookmarkForReadTxc('v4.2')) + it('v4.2', () => verifyBookmarkForReadTxc('v4.2'), 60000) }) describe('should send and receive bookmark for write transaction', () => { @@ -174,11 +163,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyBookmarkForWriteTxc('v3')) + it('v3', () => verifyBookmarkForWriteTxc('v3'), 60000) - it('v4', () => verifyBookmarkForWriteTxc('v4')) + it('v4', () => verifyBookmarkForWriteTxc('v4'), 60000) - it('v4.2', () => verifyBookmarkForWriteTxc('v4.2')) + it('v4.2', () => verifyBookmarkForWriteTxc('v4.2'), 60000) }) describe('should send and receive bookmark between write and read transactions', () => { @@ -219,11 +208,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyBookmark('v3')) + it('v3', () => verifyBookmark('v3'), 60000) - it('v4', () => verifyBookmark('v4')) + it('v4', () => verifyBookmark('v4'), 60000) - it('v4.2', () => verifyBookmark('v4.2')) + it('v4.2', () => verifyBookmark('v4.2'), 60000) }) describe('should throw service unavailable when server dies', () => { @@ -252,11 +241,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyServiceUnavailable('v3')) + it('v3', () => verifyServiceUnavailable('v3'), 60000) - it('v4', () => verifyServiceUnavailable('v4')) + it('v4', () => verifyServiceUnavailable('v4'), 60000) - it('v4.2', () => verifyServiceUnavailable('v4.2')) + it('v4.2', () => verifyServiceUnavailable('v4.2'), 60000) }) describe('should close connection when RESET fails', () => { @@ -285,11 +274,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyCloseConnection('v3')) + it('v3', () => verifyCloseConnection('v3'), 60000) - it('v4', () => verifyCloseConnection('v4')) + it('v4', () => verifyCloseConnection('v4'), 60000) - it('v4.2', () => verifyCloseConnection('v4.2')) + it('v4.2', () => verifyCloseConnection('v4.2'), 60000) }) describe('should send RESET on error', () => { @@ -318,11 +307,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyReset('v3')) + it('v3', () => verifyReset('v3'), 60000) - it('v4', () => verifyReset('v4')) + it('v4', () => verifyReset('v4'), 60000) - it('v4.2', () => verifyReset('v4.2')) + it('v4.2', () => verifyReset('v4.2'), 60000) }) describe('should include database connection id in logs', () => { @@ -366,11 +355,11 @@ describe('#stub-direct direct driver with stub server', () => { expect(containsDbConnectionIdMessage).toBeTruthy() } - it('v3', () => verifyConnectionId('v3')) + it('v3', () => verifyConnectionId('v3'), 60000) - it('v4', () => verifyConnectionId('v4')) + it('v4', () => verifyConnectionId('v4'), 60000) - it('v4.2', () => verifyConnectionId('v4.2')) + it('v4.2', () => verifyConnectionId('v4.2'), 60000) }) describe('should close connection if it dies sitting idle in connection pool', () => { @@ -415,11 +404,11 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyConnectionCleanup('v3')) + it('v3', () => verifyConnectionCleanup('v3'), 60000) - it('v4', () => verifyConnectionCleanup('v4')) + it('v4', () => verifyConnectionCleanup('v4'), 60000) - it('v4.2', () => verifyConnectionCleanup('v4.2')) + it('v4.2', () => verifyConnectionCleanup('v4.2'), 60000) }) describe('should fail if commit fails due to broken connection', () => { @@ -450,7 +439,7 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyFailureOnCommit('v3')) + it('v3', () => verifyFailureOnCommit('v3'), 60000) }) describe('should report whether multi db is supported', () => { @@ -472,9 +461,9 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifySupportsMultiDb('v3', false)) - it('v4', () => verifySupportsMultiDb('v4', true)) - it('v4.2', () => verifySupportsMultiDb('v4.2', true)) + it('v3', () => verifySupportsMultiDb('v3', false), 60000) + it('v4', () => verifySupportsMultiDb('v4', true), 60000) + it('v4.2', () => verifySupportsMultiDb('v4.2', true), 60000) it('on error', async () => { const driver = boltStub.newDriver('bolt://127.0.0.1:9001') @@ -485,7 +474,7 @@ describe('#stub-direct direct driver with stub server', () => { ) await driver.close() - }) + }, 60000) }) describe('should report whether transaction config is supported', () => { @@ -509,9 +498,9 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifySupportsTransactionConfig('v3', true)) - it('v4', () => verifySupportsTransactionConfig('v4', true)) - it('v4.2', () => verifySupportsTransactionConfig('v4.2', true)) + it('v3', () => verifySupportsTransactionConfig('v3', true), 60000) + it('v4', () => verifySupportsTransactionConfig('v4', true), 60000) + it('v4.2', () => verifySupportsTransactionConfig('v4.2', true), 60000) it('on error', async () => { const driver = boltStub.newDriver('bolt://127.0.0.1:9001') @@ -522,7 +511,7 @@ describe('#stub-direct direct driver with stub server', () => { ) await driver.close() - }) + }, 60000) }) describe('should allow to change fetch size', () => { @@ -569,8 +558,8 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v4', () => verifyFailureOnCommit('v4')) - it('v4.2', () => verifyFailureOnCommit('v4.2')) + it('v4', () => verifyFailureOnCommit('v4'), 60000) + it('v4.2', () => verifyFailureOnCommit('v4.2'), 60000) }) describe('should stream in many batches', () => { @@ -615,8 +604,8 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v4', () => verifyFailureOnCommit('v4')) - it('v4.2', () => verifyFailureOnCommit('v4.2')) + it('v4', () => verifyFailureOnCommit('v4'), 60000) + it('v4.2', () => verifyFailureOnCommit('v4.2'), 60000) }) describe('should ignore fetchSize setting', () => { @@ -661,7 +650,7 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v3', () => verifyFailureOnCommit('v3')) + it('v3', () => verifyFailureOnCommit('v3'), 60000) }) describe('should cancel stream with result summary method', () => { @@ -706,8 +695,8 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v4', () => verifyFailureOnCommit('v4')) - it('v4.2', () => verifyFailureOnCommit('v4.2')) + it('v4', () => verifyFailureOnCommit('v4'), 60000) + it('v4.2', () => verifyFailureOnCommit('v4.2'), 60000) }) describe('should cancel stream with tx commit', () => { @@ -755,8 +744,8 @@ describe('#stub-direct direct driver with stub server', () => { await server.exit() } - it('v4', () => verifyFailureOnCommit('v4')) - it('v4.2', () => verifyFailureOnCommit('v4.2')) + it('v4', () => verifyFailureOnCommit('v4'), 60000) + it('v4.2', () => verifyFailureOnCommit('v4.2'), 60000) }) function connectionPool (driver, key) { diff --git a/test/internal/node/node-host-name-resolver.test.js b/test/internal/node/node-host-name-resolver.test.js index 181a997d7..b46485c52 100644 --- a/test/internal/node/node-host-name-resolver.test.js +++ b/test/internal/node/node-host-name-resolver.test.js @@ -21,18 +21,6 @@ import NodeHostNameResolver from '../../../src/internal/node/node-host-name-reso import ServerAddress from '../../../src/internal/server-address' describe('#unit NodeHostNameResolver', () => { - let originalTimeout - - beforeEach(() => { - // it sometimes takes couple seconds to perform dns lookup, increase the async test timeout - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000 - }) - - afterEach(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - it('should resolve address', done => { const seedRouter = ServerAddress.fromUrl('neo4j.com') const resolver = new NodeHostNameResolver() @@ -49,7 +37,7 @@ describe('#unit NodeHostNameResolver', () => { done() }) - }) + }, 20000) it('should resolve address with port', done => { const seedRouter = ServerAddress.fromUrl('neo4j.com:7474') @@ -67,31 +55,31 @@ describe('#unit NodeHostNameResolver', () => { done() }) - }) + }, 20000) it('should resolve IPv4 address to itself', done => { const addressToResolve = ServerAddress.fromUrl('127.0.0.1') const expectedResolvedAddress = '127.0.0.1:7687' // includes default port testIpAddressResolution(addressToResolve, expectedResolvedAddress, done) - }) + }, 20000) it('should resolve IPv4 address with port to itself', done => { const address = ServerAddress.fromUrl('127.0.0.1:7474') const expectedResolvedAddress = '127.0.0.1:7474' // includes default port testIpAddressResolution(address, expectedResolvedAddress, done) - }) + }, 20000) it('should resolve IPv6 address to itself', done => { const addressToResolve = ServerAddress.fromUrl('[2001:4860:4860::8888]') const expectedResolvedAddress = '[2001:4860:4860::8888]:7687' // includes default port testIpAddressResolution(addressToResolve, expectedResolvedAddress, done) - }) + }, 20000) it('should resolve IPv6 address with port to itself', done => { const address = ServerAddress.fromUrl('[2001:4860:4860::8888]:7474') const expectedResolvedAddress = '[2001:4860:4860::8888]:7474' testIpAddressResolution(address, expectedResolvedAddress, done) - }) + }, 20000) }) function testIpAddressResolution (address, expectedResolvedAddress, done) { diff --git a/test/internal/node/routing.driver.boltkit.test.js b/test/internal/node/routing.driver.boltkit.test.js index 47e103412..c38fb3a85 100644 --- a/test/internal/node/routing.driver.boltkit.test.js +++ b/test/internal/node/routing.driver.boltkit.test.js @@ -27,17 +27,6 @@ import ServerAddress from '../../../src/internal/server-address' import { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION } from 'constants' describe('#stub-routing routing driver with stub server', () => { - let originalTimeout - - beforeAll(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - }) - - afterAll(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - it('should use custom user agent', async () => { if (!boltStub.supported) { return @@ -53,7 +42,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.run('MATCH (n) RETURN n.name') await driver.close() await server.exit() - }) + }, 60000) it('should discover servers', async () => { if (!boltStub.supported) { @@ -84,7 +73,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await server.exit() - }) + }, 60000) it('should discover IPv6 servers', async () => { if (!boltStub.supported) { @@ -125,7 +114,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await server.exit() - }) + }, 60000) it('should purge connections to stale servers after routing table refresh', async () => { if (!boltStub.supported) { @@ -152,7 +141,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await reader.exit() - }) + }, 60000) it('should discover servers using subscribe', done => { if (!boltStub.supported) { @@ -187,7 +176,7 @@ describe('#stub-routing routing driver with stub server', () => { } }) }) - }) + }, 60000) it('should handle empty response from server', async () => { if (!boltStub.supported) { @@ -213,7 +202,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await server.exit() - }) + }, 60000) it('should acquire read server', async () => { if (!boltStub.supported) { @@ -246,7 +235,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should pick first available route-server', async () => { if (!boltStub.supported) { @@ -293,7 +282,7 @@ describe('#stub-routing routing driver with stub server', () => { await nextRouter.exit() await readServer1.exit() await readServer2.exit() - }) + }, 60000) it('should round-robin among read servers', async () => { if (!boltStub.supported) { @@ -335,7 +324,7 @@ describe('#stub-routing routing driver with stub server', () => { await seedServer.exit() await readServer1.exit() await readServer2.exit() - }) + }, 60000) it('should handle missing read server', async () => { if (!boltStub.supported) { @@ -364,7 +353,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should acquire write server', async () => { if (!boltStub.supported) { @@ -390,7 +379,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await writeServer.exit() - }) + }, 60000) it('should round-robin among write servers', async () => { if (!boltStub.supported) { @@ -423,7 +412,7 @@ describe('#stub-routing routing driver with stub server', () => { await seedServer.exit() await writeServer1.exit() await writeServer2.exit() - }) + }, 60000) it('should handle missing write server', async () => { if (!boltStub.supported) { @@ -452,7 +441,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await writeServer.exit() - }) + }, 60000) it('should remember endpoints', async () => { if (!boltStub.supported) { @@ -484,7 +473,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should forget endpoints on failure', async () => { if (!boltStub.supported) { @@ -521,7 +510,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should forget endpoints on session acquisition failure', async () => { if (!boltStub.supported) { @@ -553,7 +542,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() - }) + }, 60000) it('should rediscover if necessary', async () => { if (!boltStub.supported) { @@ -581,7 +570,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should handle server not able to do routing', async () => { if (!boltStub.supported) { @@ -609,7 +598,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await server.exit() - }) + }, 60000) it('should handle leader switch while writing', async () => { if (!boltStub.supported) { @@ -639,7 +628,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should handle leader switch while writing on transaction', async () => { if (!boltStub.supported) { @@ -672,7 +661,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should fail if missing write server', async () => { if (!boltStub.supported) { @@ -695,7 +684,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() - }) + }, 60000) it('should try next router when current router fails to return a routing table', async () => { if (!boltStub.supported) { @@ -752,7 +741,7 @@ describe('#stub-routing routing driver with stub server', () => { await server2.exit() await server3.exit() await server4.exit() - }) + }, 60000) it('should re-use connections', async () => { if (!boltStub.supported) { @@ -788,7 +777,7 @@ describe('#stub-routing routing driver with stub server', () => { await seedServer.exit() await writeServer.exit() - }) + }, 60000) it('should expose server info in cluster', async () => { if (!boltStub.supported) { @@ -832,7 +821,7 @@ describe('#stub-routing routing driver with stub server', () => { await routingServer.exit() await writeServer.exit() await readServer.exit() - }) + }, 60000) it('should expose server info in cluster using observer', done => { if (!boltStub.supported) { @@ -899,7 +888,7 @@ describe('#stub-routing routing driver with stub server', () => { }) ) ) - }) + }, 60000) it('should forget routers when fails to connect', async () => { if (!boltStub.supported) { @@ -940,7 +929,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await server.exit() - }) + }, 60000) it('should close connection used for routing table refreshing', async () => { if (!boltStub.supported) { @@ -978,127 +967,191 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await server.exit() - }) - - it('should throw error when no records', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_no_records.script' - )) - - it('should throw error when no TTL entry', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_no_ttl_field.script' - )) - - it('should throw error when no servers entry', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_no_servers_field.script' - )) - - it('should throw error when unparsable TTL entry', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_unparsable_ttl.script' - )) - - it('should throw error when multiple records', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_multiple_records.script' - )) - - it('should throw error on unparsable record', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_unparsable_servers.script' - )) - - it('should throw error when no routers', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_no_routers.script' - )) - - it('should throw error when no readers', () => - testForProtocolError( - './test/resources/boltstub/v3/acquire_endpoints_no_readers.script' - )) - - it('should accept routing table with 1 router, 1 reader and 1 writer', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091'], - readers: ['127.0.0.1:9092'], - writers: ['127.0.0.1:9999'] - }, - 9999 - )) - - it('should accept routing table with 2 routers, 1 reader and 1 writer', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091', '127.0.0.1:9092'], - readers: ['127.0.0.1:9092'], - writers: ['127.0.0.1:9999'] - }, - 9999 - )) - - it('should accept routing table with 1 router, 2 readers and 1 writer', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091'], - readers: ['127.0.0.1:9092', '127.0.0.1:9093'], - writers: ['127.0.0.1:9999'] - }, - 9999 - )) - - it('should accept routing table with 2 routers, 2 readers and 1 writer', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091', '127.0.0.1:9092'], - readers: ['127.0.0.1:9093', '127.0.0.1:9094'], - writers: ['127.0.0.1:9999'] - }, - 9999 - )) - - it('should accept routing table with 1 router, 1 reader and 2 writers', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091'], - readers: ['127.0.0.1:9092'], - writers: ['127.0.0.1:9999', '127.0.0.1:9093'] - }, - 9999 - )) - - it('should accept routing table with 2 routers, 1 reader and 2 writers', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091', '127.0.0.1:9092'], - readers: ['127.0.0.1:9093'], - writers: ['127.0.0.1:9999', '127.0.0.1:9094'] - }, - 9999 - )) - - it('should accept routing table with 1 router, 2 readers and 2 writers', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091'], - readers: ['127.0.0.1:9092', '127.0.0.1:9093'], - writers: ['127.0.0.1:9999', '127.0.0.1:9094'] - }, - 9999 - )) - - it('should accept routing table with 2 routers, 2 readers and 2 writers', () => - testRoutingTableAcceptance( - { - routers: ['127.0.0.1:9091', '127.0.0.1:9092'], - readers: ['127.0.0.1:9093', '127.0.0.1:9094'], - writers: ['127.0.0.1:9999', '127.0.0.1:9095'] - }, - 9999 - )) + }, 60000) + + it( + 'should throw error when no records', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_no_records.script' + ), + 60000 + ) + + it( + 'should throw error when no TTL entry', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_no_ttl_field.script' + ), + 60000 + ) + + it( + 'should throw error when no servers entry', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_no_servers_field.script' + ), + 60000 + ) + + it( + 'should throw error when unparsable TTL entry', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_unparsable_ttl.script' + ), + 60000 + ) + + it( + 'should throw error when multiple records', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_multiple_records.script' + ), + 60000 + ) + + it( + 'should throw error on unparsable record', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_unparsable_servers.script' + ), + 60000 + ) + + it( + 'should throw error when no routers', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_no_routers.script' + ), + 60000 + ) + + it( + 'should throw error when no readers', + () => + testForProtocolError( + './test/resources/boltstub/v3/acquire_endpoints_no_readers.script' + ), + 60000 + ) + + it( + 'should accept routing table with 1 router, 1 reader and 1 writer', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091'], + readers: ['127.0.0.1:9092'], + writers: ['127.0.0.1:9999'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 2 routers, 1 reader and 1 writer', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091', '127.0.0.1:9092'], + readers: ['127.0.0.1:9092'], + writers: ['127.0.0.1:9999'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 1 router, 2 readers and 1 writer', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091'], + readers: ['127.0.0.1:9092', '127.0.0.1:9093'], + writers: ['127.0.0.1:9999'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 2 routers, 2 readers and 1 writer', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091', '127.0.0.1:9092'], + readers: ['127.0.0.1:9093', '127.0.0.1:9094'], + writers: ['127.0.0.1:9999'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 1 router, 1 reader and 2 writers', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091'], + readers: ['127.0.0.1:9092'], + writers: ['127.0.0.1:9999', '127.0.0.1:9093'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 2 routers, 1 reader and 2 writers', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091', '127.0.0.1:9092'], + readers: ['127.0.0.1:9093'], + writers: ['127.0.0.1:9999', '127.0.0.1:9094'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 1 router, 2 readers and 2 writers', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091'], + readers: ['127.0.0.1:9092', '127.0.0.1:9093'], + writers: ['127.0.0.1:9999', '127.0.0.1:9094'] + }, + 9999 + ), + 60000 + ) + + it( + 'should accept routing table with 2 routers, 2 readers and 2 writers', + () => + testRoutingTableAcceptance( + { + routers: ['127.0.0.1:9091', '127.0.0.1:9092'], + readers: ['127.0.0.1:9093', '127.0.0.1:9094'], + writers: ['127.0.0.1:9999', '127.0.0.1:9095'] + }, + 9999 + ), + 60000 + ) it('should send and receive bookmark', async () => { if (!boltStub.supported) { @@ -1129,13 +1182,24 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await writer.exit() - }) - - it('should send initial bookmark without access mode', () => - testWriteSessionWithAccessModeAndBookmark(null, 'neo4j:bookmark:v1:tx42')) - - it('should use write session mode and initial bookmark', () => - testWriteSessionWithAccessModeAndBookmark(WRITE, 'neo4j:bookmark:v1:tx42')) + }, 60000) + + it( + 'should send initial bookmark without access mode', + () => + testWriteSessionWithAccessModeAndBookmark(null, 'neo4j:bookmark:v1:tx42'), + 60000 + ) + + it( + 'should use write session mode and initial bookmark', + () => + testWriteSessionWithAccessModeAndBookmark( + WRITE, + 'neo4j:bookmark:v1:tx42' + ), + 60000 + ) it('should use read session mode and initial bookmark', async () => { if (!boltStub.supported) { @@ -1171,7 +1235,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await writer.exit() - }) + }, 60000) it('should pass bookmark from transaction to transaction', async () => { if (!boltStub.supported) { @@ -1208,7 +1272,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await writer.exit() - }) + }, 60000) it('should retry read transaction until success', async () => { if (!boltStub.supported) { @@ -1245,7 +1309,7 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() await brokenReader.exit() await reader.exit() - }) + }, 60000) it('should retry write transaction until success', async () => { if (!boltStub.supported) { @@ -1282,7 +1346,7 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() await brokenWriter.exit() await writer.exit() - }) + }, 60000) it('should retry read transaction until failure', async () => { if (!boltStub.supported) { @@ -1331,7 +1395,7 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() await brokenReader1.exit() await brokenReader2.exit() - }) + }, 60000) it('should retry write transaction until failure', async () => { if (!boltStub.supported) { @@ -1380,7 +1444,7 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() await brokenWriter1.exit() await brokenWriter2.exit() - }) + }, 60000) it('should retry read transaction and perform rediscovery until success', async () => { if (!boltStub.supported) { @@ -1427,7 +1491,7 @@ describe('#stub-routing routing driver with stub server', () => { s.exit() ) ) - }) + }, 60000) it('should retry write transaction and perform rediscovery until success', async () => { if (!boltStub.supported) { @@ -1474,7 +1538,7 @@ describe('#stub-routing routing driver with stub server', () => { s.exit() ) ) - }) + }, 60000) it('should use seed router for rediscovery when all other routers are dead', async () => { if (!boltStub.supported) { @@ -1520,7 +1584,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await router2.exit() - }) + }, 60000) it('should use resolved seed router addresses for rediscovery when all other routers are dead', async () => { if (!boltStub.supported) { @@ -1560,7 +1624,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router1.exit() await router2.exit() - }) + }, 60000) it('should send routing context to server', async () => { if (!boltStub.supported) { @@ -1583,7 +1647,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await router.exit() - }) + }, 60000) it('should treat routing table with single router as valid', async () => { if (!boltStub.supported) { @@ -1619,7 +1683,7 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() await reader1.exit() await reader2.exit() - }) + }, 60000) it('should use routing table without writers for reads', async () => { if (!boltStub.supported) { @@ -1649,7 +1713,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await reader.exit() - }) + }, 60000) it('should serve reads but fail writes when no writers available', async () => { if (!boltStub.supported) { @@ -1693,7 +1757,7 @@ describe('#stub-routing routing driver with stub server', () => { await router1.exit() await router2.exit() await reader.exit() - }) + }, 60000) it('should accept routing table without writers and then rediscover', async () => { if (!boltStub.supported) { @@ -1741,7 +1805,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await Promise.all([router1, router2, reader, writer].map(s => s.exit())) - }) + }, 60000) it('should use resolved seed router for discovery after accepting a table without writers', async () => { if (!boltStub.supported) { @@ -1787,7 +1851,7 @@ describe('#stub-routing routing driver with stub server', () => { await Promise.all( [seedRouter, resolvedSeedRouter, reader, writer].map(s => s.exit()) ) - }) + }, 60000) it('should fail rediscovery on auth error', async () => { if (!boltStub.supported) { @@ -1811,7 +1875,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await router.exit() - }) + }, 60000) it('should send multiple bookmarks', async () => { if (!boltStub.supported) { @@ -1848,52 +1912,79 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await router.exit() await writer.exit() - }) - - it('should forget writer on database unavailable error', () => - testAddressPurgeOnDatabaseError( - './test/resources/boltstub/v3/write_database_unavailable.script', - "CREATE (n {name:'Bob'})", - WRITE - )) - - it('should forget reader on database unavailable error', () => - testAddressPurgeOnDatabaseError( - './test/resources/boltstub/v3/read_database_unavailable.script', - 'RETURN 1', - READ - )) - - it('should use resolver function that returns array during first discovery', () => - testResolverFunctionDuringFirstDiscovery(['127.0.0.1:9010'])) - - it('should use resolver function that returns promise during first discovery', () => - testResolverFunctionDuringFirstDiscovery( - Promise.resolve(['127.0.0.1:9010']) - )) - - it('should fail first discovery when configured resolver function throws', () => - testResolverFunctionFailureDuringFirstDiscovery( - () => { - throw new Error('Broken resolver') - }, - null, - 'Broken resolver' - )) - - it('should fail first discovery when configured resolver function returns no addresses', () => - testResolverFunctionFailureDuringFirstDiscovery( - () => [], - SERVICE_UNAVAILABLE, - 'No routing servers available' - )) - - it('should fail first discovery when configured resolver function returns a string instead of array of addresses', () => - testResolverFunctionFailureDuringFirstDiscovery( - () => 'Hello', - null, - 'Configured resolver function should either return an array of addresses' - )) + }, 60000) + + it( + 'should forget writer on database unavailable error', + () => + testAddressPurgeOnDatabaseError( + './test/resources/boltstub/v3/write_database_unavailable.script', + "CREATE (n {name:'Bob'})", + WRITE + ), + 60000 + ) + + it( + 'should forget reader on database unavailable error', + () => + testAddressPurgeOnDatabaseError( + './test/resources/boltstub/v3/read_database_unavailable.script', + 'RETURN 1', + READ + ), + 60000 + ) + + it( + 'should use resolver function that returns array during first discovery', + () => testResolverFunctionDuringFirstDiscovery(['127.0.0.1:9010']), + 60000 + ) + + it( + 'should use resolver function that returns promise during first discovery', + () => + testResolverFunctionDuringFirstDiscovery( + Promise.resolve(['127.0.0.1:9010']) + ), + 60000 + ) + + it( + 'should fail first discovery when configured resolver function throws', + () => + testResolverFunctionFailureDuringFirstDiscovery( + () => { + throw new Error('Broken resolver') + }, + null, + 'Broken resolver' + ), + 60000 + ) + + it( + 'should fail first discovery when configured resolver function returns no addresses', + () => + testResolverFunctionFailureDuringFirstDiscovery( + () => [], + SERVICE_UNAVAILABLE, + 'No routing servers available' + ), + 60000 + ) + + it( + 'should fail first discovery when configured resolver function returns a string instead of array of addresses', + () => + testResolverFunctionFailureDuringFirstDiscovery( + () => 'Hello', + null, + 'Configured resolver function should either return an array of addresses' + ), + 60000 + ) it('should use resolver function during rediscovery when existing routers fail', async () => { if (!boltStub.supported) { @@ -1957,13 +2048,17 @@ describe('#stub-routing routing driver with stub server', () => { await router1.exit() await router2.exit() await reader.exit() - }) + }, 60000) - it('should connect to cluster when disableLosslessIntegers is on', () => - testDiscoveryAndReadQueryInAutoCommitTx( - './test/resources/boltstub/v3/acquire_endpoints.script', - { disableLosslessIntegers: true } - )) + it( + 'should connect to cluster when disableLosslessIntegers is on', + () => + testDiscoveryAndReadQueryInAutoCommitTx( + './test/resources/boltstub/v3/acquire_endpoints.script', + { disableLosslessIntegers: true } + ), + 60000 + ) it('should send read access mode on query metadata', async () => { if (!boltStub.supported) { @@ -1993,7 +2088,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should send read access mode on query metadata with read transaction', async () => { if (!boltStub.supported) { @@ -2025,7 +2120,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await readServer.exit() - }) + }, 60000) it('should not send write access mode on query metadata', async () => { if (!boltStub.supported) { @@ -2050,7 +2145,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await writeServer.exit() - }) + }, 60000) it('should not send write access mode on query metadata with write transaction', async () => { if (!boltStub.supported) { @@ -2075,7 +2170,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await seedServer.exit() await writeServer.exit() - }) + }, 60000) it('should revert to initial router if the only known router returns invalid routing table', async () => { if (!boltStub.supported) { @@ -2115,7 +2210,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await Promise.all([router1, router2, router3, reader].map(s => s.exit())) - }) + }, 60000) describe('multi-Database', () => { async function verifyDiscoverAndRead (script, database) { @@ -2195,17 +2290,29 @@ describe('#stub-routing routing driver with stub server', () => { await writeServer.exit() } - it('should discover servers for default database and read', () => - verifyDiscoverAndRead('read', '')) + it( + 'should discover servers for default database and read', + () => verifyDiscoverAndRead('read', ''), + 60000 + ) - it('should discover servers for aDatabase and read', () => - verifyDiscoverAndRead('read_from_aDatabase', 'aDatabase')) + it( + 'should discover servers for aDatabase and read', + () => verifyDiscoverAndRead('read_from_aDatabase', 'aDatabase'), + 60000 + ) - it('should discover servers for default database and write', () => - verifyDiscoverAndWrite('write', '')) + it( + 'should discover servers for default database and write', + () => verifyDiscoverAndWrite('write', ''), + 60000 + ) - it('should discover servers for aDatabase and write', () => - verifyDiscoverAndWrite('write_to_aDatabase', 'aDatabase')) + it( + 'should discover servers for aDatabase and write', + () => verifyDiscoverAndWrite('write_to_aDatabase', 'aDatabase'), + 60000 + ) it('should fail discovery if database not found', async () => { if (!boltStub.supported) { @@ -2232,7 +2339,7 @@ describe('#stub-routing routing driver with stub server', () => { await session.close() await driver.close() await server.exit() - }) + }, 60000) it('should try next server for empty routing table response', async () => { if (!boltStub.supported) { @@ -2277,7 +2384,7 @@ describe('#stub-routing routing driver with stub server', () => { await router1.exit() await router2.exit() await reader1.exit() - }) + }, 60000) it('should use provided bookmarks for the discovery', async () => { if (!boltStub.supported) { @@ -2312,7 +2419,7 @@ describe('#stub-routing routing driver with stub server', () => { await driver.close() await server.exit() await readServer.exit() - }) + }, 60000) it('should ignore provided bookmarks for the discovery', async () => { if (!boltStub.supported) { @@ -2347,7 +2454,7 @@ describe('#stub-routing routing driver with stub server', () => { await server.exit() await readServer.exit() }) - }) + }, 60000) describe('should report whether multi db is supported', () => { async function verifySupportsMultiDb (version, expected) { @@ -2392,13 +2499,24 @@ describe('#stub-routing routing driver with stub server', () => { await server.exit() } - it('v3', () => verifySupportsMultiDb('v3', false)) - it('v4', () => verifySupportsMultiDb('v4', true)) - it('v4.2', () => verifySupportsMultiDb('v4.2', true)) - it('v3 with resolver', () => verifySupportsMultiDbWithResolver('v3', false)) - it('v4 with resolver', () => verifySupportsMultiDbWithResolver('v4', true)) - it('v4.2 with resolver', () => - verifySupportsMultiDbWithResolver('v4.2', true)) + it('v3', () => verifySupportsMultiDb('v3', false), 60000) + it('v4', () => verifySupportsMultiDb('v4', true), 60000) + it('v4.2', () => verifySupportsMultiDb('v4.2', true), 60000) + it( + 'v3 with resolver', + () => verifySupportsMultiDbWithResolver('v3', false), + 60000 + ) + it( + 'v4 with resolver', + () => verifySupportsMultiDbWithResolver('v4', true), + 60000 + ) + it( + 'v4.2 with resolver', + () => verifySupportsMultiDbWithResolver('v4.2', true), + 60000 + ) it('on error', async () => { const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') @@ -2409,7 +2527,7 @@ describe('#stub-routing routing driver with stub server', () => { ) await driver.close() - }) + }, 60000) }) describe('should send address in routing context', () => { @@ -2434,8 +2552,8 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() } - it('v4.1', () => verify('v4.1')) - it('v4.2', () => verify('v4.2')) + it('v4.1', () => verify('v4.1'), 60000) + it('v4.2', () => verify('v4.2'), 60000) }) describe('should send routing context with hello to enable server routing', () => { @@ -2460,8 +2578,8 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() } - it('v4.1', () => verify('v4.1')) - it('v4.2', () => verify('v4.2')) + it('v4.1', () => verify('v4.1'), 60000) + it('v4.2', () => verify('v4.2'), 60000) }) describe('should send empty routing context with hello to enable server routing', () => { @@ -2484,8 +2602,8 @@ describe('#stub-routing routing driver with stub server', () => { await router.exit() } - it('v4.1', () => verify('v4.1')) - it('v4.2', () => verify('v4.2')) + it('v4.1', () => verify('v4.1'), 60000) + it('v4.2', () => verify('v4.2'), 60000) }) describe('should report whether transaction config is supported', () => { @@ -2538,15 +2656,24 @@ describe('#stub-routing routing driver with stub server', () => { await server.exit() } - it('v3', () => verifySupportsTransactionConfig('v3', true)) - it('v4', () => verifySupportsTransactionConfig('v4', true)) - it('v4.2', () => verifySupportsTransactionConfig('v4.2', true)) - it('v3 with resolver', () => - verifySupportsTransactionConfigWithResolver('v3', true)) - it('v4 with resolver', () => - verifySupportsTransactionConfigWithResolver('v4', true)) - it('v4.2 with resolver', () => - verifySupportsTransactionConfigWithResolver('v4.2', true)) + it('v3', () => verifySupportsTransactionConfig('v3', true), 60000) + it('v4', () => verifySupportsTransactionConfig('v4', true), 60000) + it('v4.2', () => verifySupportsTransactionConfig('v4.2', true), 60000) + it( + 'v3 with resolver', + () => verifySupportsTransactionConfigWithResolver('v3', true), + 60000 + ) + it( + 'v4 with resolver', + () => verifySupportsTransactionConfigWithResolver('v4', true), + 60000 + ) + it( + 'v4.2 with resolver', + () => verifySupportsTransactionConfigWithResolver('v4.2', true), + 60000 + ) it('on error', async () => { const driver = boltStub.newDriver('neo4j://127.0.0.1:9001') @@ -2557,7 +2684,7 @@ describe('#stub-routing routing driver with stub server', () => { ) await driver.close() - }) + }, 60000) }) async function testAddressPurgeOnDatabaseError (script, query, accessMode) { diff --git a/test/internal/transaction-executor.test.js b/test/internal/transaction-executor.test.js index 441b82f47..eda8a97b4 100644 --- a/test/internal/transaction-executor.test.js +++ b/test/internal/transaction-executor.test.js @@ -32,17 +32,6 @@ const OOM_ERROR = 'Neo.DatabaseError.General.OutOfMemoryError' // Not exactly integration tests but annoyingly slow for being a unit tests. describe('#integration TransactionExecutor', () => { - let originalTimeout - - beforeEach(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - }) - - afterEach(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - it('should retry until database error happens', async () => { await testNoRetryOnUnknownError( [ @@ -55,7 +44,7 @@ describe('#integration TransactionExecutor', () => { ], 5 ) - }) + }, 60000) it('should stop retrying when time expires', async () => { let clock @@ -93,7 +82,7 @@ describe('#integration TransactionExecutor', () => { clock.uninstall() } } - }) + }, 60000) it('should cancel in-flight timeouts when closed', async () => { const fakeSetTimeout = setTimeoutMock.install() @@ -126,58 +115,47 @@ describe('#integration TransactionExecutor', () => { } finally { fakeSetTimeout.uninstall() } - }) + }, 60000) }) describe('#unit TransactionExecutor', () => { - let originalTimeout - - beforeEach(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000 - }) - - afterEach(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - it('should retry when transaction work returns promise rejected with SERVICE_UNAVAILABLE', async () => { await testRetryWhenTransactionWorkReturnsRejectedPromise([ SERVICE_UNAVAILABLE ]) - }) + }, 30000) it('should retry when transaction work returns promise rejected with SESSION_EXPIRED', async () => { await testRetryWhenTransactionWorkReturnsRejectedPromise([SESSION_EXPIRED]) - }) + }, 30000) it('should retry when transaction work returns promise rejected with deadlock error', async () => { await testRetryWhenTransactionWorkReturnsRejectedPromise([ TRANSIENT_ERROR_1 ]) - }) + }, 30000) it('should retry when transaction work returns promise rejected with communication error', async () => { await testRetryWhenTransactionWorkReturnsRejectedPromise([ TRANSIENT_ERROR_2 ]) - }) + }, 30000) it('should not retry when transaction work returns promise rejected with OOM error', async () => { await testNoRetryOnUnknownError([OOM_ERROR], 1) - }) + }, 30000) it('should not retry when transaction work returns promise rejected with unknown error', async () => { await testNoRetryOnUnknownError([UNKNOWN_ERROR], 1) - }) + }, 30000) it('should not retry when transaction work returns promise rejected with transaction termination error', async () => { await testNoRetryOnUnknownError([TX_TERMINATED_ERROR], 1) - }) + }, 30000) it('should not retry when transaction work returns promise rejected with locks termination error', async () => { await testNoRetryOnUnknownError([LOCKS_TERMINATED_ERROR], 1) - }) + }, 30000) it('should not retry when transaction work returns promise rejected with unknown error type', async () => { class MyTestError extends Error { @@ -194,11 +172,11 @@ describe('#unit TransactionExecutor', () => { await expectAsync( executor.execute(transactionCreator(), tx => realWork()) ).toBeRejectedWith(error) - }) + }, 30000) it('should retry when given transaction creator throws once', async () => { await testRetryWhenTransactionCreatorFails([SERVICE_UNAVAILABLE]) - }) + }, 30000) it('should retry when given transaction creator throws many times', async () => { await testRetryWhenTransactionCreatorFails([ @@ -209,11 +187,11 @@ describe('#unit TransactionExecutor', () => { SERVICE_UNAVAILABLE, TRANSIENT_ERROR_1 ]) - }) + }, 30000) it('should retry when given transaction work throws once', async () => { await testRetryWhenTransactionWorkThrows([SERVICE_UNAVAILABLE]) - }) + }, 30000) it('should retry when given transaction work throws many times', async () => { await testRetryWhenTransactionWorkThrows([ @@ -222,7 +200,7 @@ describe('#unit TransactionExecutor', () => { TRANSIENT_ERROR_2, SESSION_EXPIRED ]) - }) + }, 30000) it('should retry when given transaction work returns rejected promise many times', async () => { await testRetryWhenTransactionWorkReturnsRejectedPromise([ @@ -233,13 +211,13 @@ describe('#unit TransactionExecutor', () => { TRANSIENT_ERROR_1, SESSION_EXPIRED ]) - }) + }, 30000) it('should retry when transaction commit returns rejected promise once', async () => { await testRetryWhenTransactionCommitReturnsRejectedPromise([ TRANSIENT_ERROR_1 ]) - }) + }, 30000) it('should retry when transaction commit returns rejected promise multiple times', async () => { await testRetryWhenTransactionCommitReturnsRejectedPromise([ @@ -249,7 +227,7 @@ describe('#unit TransactionExecutor', () => { SERVICE_UNAVAILABLE, TRANSIENT_ERROR_2 ]) - }) + }, 30000) it('should retry when transaction work throws and rollback fails', async () => { await testRetryWhenTransactionWorkThrowsAndRollbackFails( @@ -261,26 +239,26 @@ describe('#unit TransactionExecutor', () => { ], [SESSION_EXPIRED, TRANSIENT_ERROR_1] ) - }) + }, 30000) it('should allow zero max retry time', () => { const executor = new TransactionExecutor(0) expect(executor._maxRetryTimeMs).toEqual(0) - }) + }, 30000) it('should allow zero initial delay', () => { const executor = new TransactionExecutor(42, 0) expect(executor._initialRetryDelayMs).toEqual(0) - }) + }, 30000) it('should disallow zero multiplier', () => { expect(() => new TransactionExecutor(42, 42, 0)).toThrow() - }) + }, 30000) it('should allow zero jitter factor', () => { const executor = new TransactionExecutor(42, 42, 42, 0) expect(executor._jitterFactor).toEqual(0) - }) + }, 30000) async function testRetryWhenTransactionCreatorFails (errorCodes) { const fakeSetTimeout = setTimeoutMock.install() diff --git a/test/nested-statements.test.js b/test/nested-statements.test.js index 92ac3ba02..fa9a71090 100644 --- a/test/nested-statements.test.js +++ b/test/nested-statements.test.js @@ -45,7 +45,6 @@ describe('#integration session', () => { let session // eslint-disable-next-line no-unused-vars let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -53,14 +52,11 @@ describe('#integration session', () => { sharedNeo4j.authToken ) session = driver.session({ fetchSize: 2 }) - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver) }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await driver.close() }) @@ -102,7 +98,7 @@ describe('#integration session', () => { console.log(error) } }) - }) + }, 60000) it('should give proper error when nesting queries within one session', done => { const size = 20 @@ -130,7 +126,7 @@ describe('#integration session', () => { console.log(error) } }) - }) + }, 60000) it('should handle sequential query runs within one session', done => { const size = 20 @@ -151,5 +147,5 @@ describe('#integration session', () => { expect(count).toEqual(size) session.close().then(() => done()) }) - }) + }, 60000) }) diff --git a/test/rx/navigation.test.js b/test/rx/navigation.test.js index 9f83468c6..58db78843 100644 --- a/test/rx/navigation.test.js +++ b/test/rx/navigation.test.js @@ -30,7 +30,6 @@ describe('#integration-rx navigation', () => { let session /** @type {number} */ let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -38,83 +37,147 @@ describe('#integration-rx navigation', () => { sharedNeo4j.authToken ) session = driver.rxSession() - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver) }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout if (session) { await session.close().toPromise() } await driver.close() }) - it('should return keys', () => shouldReturnKeys(protocolVersion, session)) + it( + 'should return keys', + () => shouldReturnKeys(protocolVersion, session), + 60000 + ) - it('should return summary', () => - shouldReturnSummary(protocolVersion, session)) + it( + 'should return summary', + () => shouldReturnSummary(protocolVersion, session), + 60000 + ) - it('should return keys and records', () => - shouldReturnKeysAndRecords(protocolVersion, session)) + it( + 'should return keys and records', + () => shouldReturnKeysAndRecords(protocolVersion, session), + 60000 + ) - it('should return records and summary', () => - shouldReturnRecordsAndSummary(protocolVersion, session)) + it( + 'should return records and summary', + () => shouldReturnRecordsAndSummary(protocolVersion, session), + 60000 + ) - it('should return keys, records and summary', () => - shouldReturnKeysRecordsAndSummary(protocolVersion, session)) + it( + 'should return keys, records and summary', + () => shouldReturnKeysRecordsAndSummary(protocolVersion, session), + 60000 + ) - it('should return keys and summary but no records', () => - shouldReturnKeysAndSummaryButRecords(protocolVersion, session)) + it( + 'should return keys and summary but no records', + () => shouldReturnKeysAndSummaryButRecords(protocolVersion, session), + 60000 + ) - it('should return keys even after records are complete', () => - shouldReturnKeysEvenAfterRecordsAreComplete(protocolVersion, session)) + it( + 'should return keys even after records are complete', + () => + shouldReturnKeysEvenAfterRecordsAreComplete(protocolVersion, session), + 60000 + ) - it('should return keys even after summary is complete', () => - shouldReturnKeysEvenAfterSummaryIsComplete(protocolVersion, session)) + it( + 'should return keys even after summary is complete', + () => + shouldReturnKeysEvenAfterSummaryIsComplete(protocolVersion, session), + 60000 + ) - it('should return keys multiple times', () => - shouldReturnKeysMultipleTimes(protocolVersion, session)) + it( + 'should return keys multiple times', + () => shouldReturnKeysMultipleTimes(protocolVersion, session), + 60000 + ) - it('should return summary multiple times', () => - shouldReturnSummaryMultipleTimes(protocolVersion, session)) + it( + 'should return summary multiple times', + () => shouldReturnSummaryMultipleTimes(protocolVersion, session), + 60000 + ) - it('should return records only once', () => - shouldReturnRecordsOnlyOnce(protocolVersion, session)) + it( + 'should return records only once', + () => shouldReturnRecordsOnlyOnce(protocolVersion, session), + 60000 + ) - it('should return empty keys for query without return', () => - shouldReturnEmptyKeysForQueryWithNoReturn(protocolVersion, session)) + it( + 'should return empty keys for query without return', + () => shouldReturnEmptyKeysForQueryWithNoReturn(protocolVersion, session), + 60000 + ) - it('should return no records for query without return', () => - shouldReturnNoRecordsForQueryWithNoReturn(protocolVersion, session)) + it( + 'should return no records for query without return', + () => shouldReturnNoRecordsForQueryWithNoReturn(protocolVersion, session), + 60000 + ) - it('should return summary for query without return', () => - shouldReturnSummaryForQueryWithNoReturn(protocolVersion, session)) + it( + 'should return summary for query without return', + () => shouldReturnSummaryForQueryWithNoReturn(protocolVersion, session), + 60000 + ) - it('should fail on keys when run fails', () => - shouldFailOnKeysWhenRunFails(protocolVersion, session)) + it( + 'should fail on keys when run fails', + () => shouldFailOnKeysWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on subsequent keys when run fails', () => - shouldFailOnSubsequentKeysWhenRunFails(protocolVersion, session)) + it( + 'should fail on subsequent keys when run fails', + () => shouldFailOnSubsequentKeysWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on records when run fails', () => - shouldFailOnRecordsWhenRunFails(protocolVersion, session)) + it( + 'should fail on records when run fails', + () => shouldFailOnRecordsWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on subsequent records differently when run fails', () => - shouldFailOnSubsequentRecordsWhenRunFails(protocolVersion, session)) + it( + 'should fail on subsequent records differently when run fails', + () => shouldFailOnSubsequentRecordsWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on summary when run fails', () => - shouldFailOnSummaryWhenRunFails(protocolVersion, session)) + it( + 'should fail on summary when run fails', + () => shouldFailOnSummaryWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on subsequent summary when run fails', () => - shouldFailOnSubsequentSummaryWhenRunFails(protocolVersion, session)) + it( + 'should fail on subsequent summary when run fails', + () => shouldFailOnSubsequentSummaryWhenRunFails(protocolVersion, session), + 60000 + ) - it('should fail on result when closed', () => - shouldFailOnResultWhenClosed(protocolVersion, session, () => - session.close() - )) + it( + 'should fail on result when closed', + () => + shouldFailOnResultWhenClosed(protocolVersion, session, () => + session.close() + ), + 60000 + ) }) describe('transaction', () => { @@ -125,7 +188,6 @@ describe('#integration-rx navigation', () => { let txc /** @type {number} */ let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -134,8 +196,6 @@ describe('#integration-rx navigation', () => { ) session = driver.rxSession() txc = await session.beginTransaction().toPromise() - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 const normalSession = driver.session() try { @@ -147,7 +207,6 @@ describe('#integration-rx navigation', () => { }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout if (txc) { try { await txc.commit().toPromise() @@ -161,69 +220,141 @@ describe('#integration-rx navigation', () => { await driver.close() }) - it('should return keys', () => shouldReturnKeys(protocolVersion, txc)) + it( + 'should return keys', + () => shouldReturnKeys(protocolVersion, txc), + 60000 + ) - it('should return summary', () => shouldReturnSummary(protocolVersion, txc)) + it( + 'should return summary', + () => shouldReturnSummary(protocolVersion, txc), + 60000 + ) - it('should return keys and records', () => - shouldReturnKeysAndRecords(protocolVersion, txc)) + it( + 'should return keys and records', + () => shouldReturnKeysAndRecords(protocolVersion, txc), + 60000 + ) - it('should return records and summary', () => - shouldReturnRecordsAndSummary(protocolVersion, txc)) + it( + 'should return records and summary', + () => shouldReturnRecordsAndSummary(protocolVersion, txc), + 60000 + ) - it('should return keys, records and summary', () => - shouldReturnKeysRecordsAndSummary(protocolVersion, txc)) + it( + 'should return keys, records and summary', + () => shouldReturnKeysRecordsAndSummary(protocolVersion, txc), + 60000 + ) - it('should return keys and summary but no records', () => - shouldReturnKeysAndSummaryButRecords(protocolVersion, txc)) + it( + 'should return keys and summary but no records', + () => shouldReturnKeysAndSummaryButRecords(protocolVersion, txc), + 60000 + ) - it('should return keys even after records are complete', () => - shouldReturnKeysEvenAfterRecordsAreComplete(protocolVersion, txc)) + it( + 'should return keys even after records are complete', + () => shouldReturnKeysEvenAfterRecordsAreComplete(protocolVersion, txc), + 60000 + ) - it('should return keys even after summary is complete', () => - shouldReturnKeysEvenAfterSummaryIsComplete(protocolVersion, txc)) + it( + 'should return keys even after summary is complete', + () => shouldReturnKeysEvenAfterSummaryIsComplete(protocolVersion, txc), + 60000 + ) - it('should return keys multiple times', () => - shouldReturnKeysMultipleTimes(protocolVersion, txc)) + it( + 'should return keys multiple times', + () => shouldReturnKeysMultipleTimes(protocolVersion, txc), + 60000 + ) - it('should return summary multiple times', () => - shouldReturnSummaryMultipleTimes(protocolVersion, txc)) + it( + 'should return summary multiple times', + () => shouldReturnSummaryMultipleTimes(protocolVersion, txc), + 60000 + ) - it('should return records only once', () => - shouldReturnRecordsOnlyOnce(protocolVersion, txc)) + it( + 'should return records only once', + () => shouldReturnRecordsOnlyOnce(protocolVersion, txc), + 60000 + ) - it('should return empty keys for query without return', () => - shouldReturnEmptyKeysForQueryWithNoReturn(protocolVersion, txc)) + it( + 'should return empty keys for query without return', + () => shouldReturnEmptyKeysForQueryWithNoReturn(protocolVersion, txc), + 60000 + ) - it('should return no records for query without return', () => - shouldReturnNoRecordsForQueryWithNoReturn(protocolVersion, txc)) + it( + 'should return no records for query without return', + () => shouldReturnNoRecordsForQueryWithNoReturn(protocolVersion, txc), + 60000 + ) - it('should return summary for query without return', () => - shouldReturnSummaryForQueryWithNoReturn(protocolVersion, txc)) + it( + 'should return summary for query without return', + () => shouldReturnSummaryForQueryWithNoReturn(protocolVersion, txc), + 60000 + ) - it('should fail on keys when run fails', () => - shouldFailOnKeysWhenRunFails(protocolVersion, txc)) + it( + 'should fail on keys when run fails', + () => shouldFailOnKeysWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on subsequent keys when run fails', () => - shouldFailOnSubsequentKeysWhenRunFails(protocolVersion, txc)) + it( + 'should fail on subsequent keys when run fails', + () => shouldFailOnSubsequentKeysWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on records when run fails', () => - shouldFailOnRecordsWhenRunFails(protocolVersion, txc)) + it( + 'should fail on records when run fails', + () => shouldFailOnRecordsWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on subsequent records differently when run fails', () => - shouldFailOnSubsequentRecordsWhenRunFails(protocolVersion, txc)) + it( + 'should fail on subsequent records differently when run fails', + () => shouldFailOnSubsequentRecordsWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on summary when run fails', () => - shouldFailOnSummaryWhenRunFails(protocolVersion, txc)) + it( + 'should fail on summary when run fails', + () => shouldFailOnSummaryWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on subsequent summary when run fails', () => - shouldFailOnSubsequentSummaryWhenRunFails(protocolVersion, txc)) + it( + 'should fail on subsequent summary when run fails', + () => shouldFailOnSubsequentSummaryWhenRunFails(protocolVersion, txc), + 60000 + ) - it('should fail on result when committed', () => - shouldFailOnResultWhenClosed(protocolVersion, txc, () => txc.commit())) + it( + 'should fail on result when committed', + () => + shouldFailOnResultWhenClosed(protocolVersion, txc, () => txc.commit()), + 60000 + ) - it('should fail on result when rolled back', () => - shouldFailOnResultWhenClosed(protocolVersion, txc, () => txc.rollback())) + it( + 'should fail on result when rolled back', + () => + shouldFailOnResultWhenClosed(protocolVersion, txc, () => + txc.rollback() + ), + 60000 + ) }) /** diff --git a/test/rx/session.test.js b/test/rx/session.test.js index 30ef99ecb..7302a2764 100644 --- a/test/rx/session.test.js +++ b/test/rx/session.test.js @@ -24,7 +24,6 @@ import sharedNeo4j from '../internal/shared-neo4j' import { newError, SERVICE_UNAVAILABLE, SESSION_EXPIRED } from '../../src/error' describe('#integration rx-session', () => { - let originalTimeout let driver /** @type {RxSession} */ let session @@ -32,8 +31,6 @@ describe('#integration rx-session', () => { let protocolVersion beforeEach(async () => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 driver = neo4j.driver( `bolt://${sharedNeo4j.hostname}`, sharedNeo4j.authToken @@ -44,7 +41,6 @@ describe('#integration rx-session', () => { }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout if (session) { await session.close().toPromise() } @@ -73,7 +69,7 @@ describe('#integration rx-session', () => { Notification.createNext(4), Notification.createComplete() ]) - }) + }, 60000) it('should be able to reuse session after failure', async () => { if (protocolVersion < 4.0) { @@ -102,7 +98,7 @@ describe('#integration rx-session', () => { Notification.createNext(1), Notification.createComplete() ]) - }) + }, 60000) it('should run transactions without retries', async () => { if (protocolVersion < 4.0) { @@ -124,7 +120,7 @@ describe('#integration rx-session', () => { expect(txcWork.invocations).toBe(1) expect(await countNodes('WithoutRetry')).toBe(1) - }) + }, 60000) it('should run transaction with retries on reactive failures', async () => { if (protocolVersion < 4.0) { @@ -151,7 +147,7 @@ describe('#integration rx-session', () => { expect(txcWork.invocations).toBe(4) expect(await countNodes('WithReactiveFailure')).toBe(1) - }) + }, 60000) it('should run transaction with retries on synchronous failures', async () => { if (protocolVersion < 4.0) { @@ -178,7 +174,7 @@ describe('#integration rx-session', () => { expect(txcWork.invocations).toBe(4) expect(await countNodes('WithSyncFailure')).toBe(1) - }) + }, 60000) it('should fail on transactions that cannot be retried', async () => { if (protocolVersion < 4.0) { @@ -201,7 +197,7 @@ describe('#integration rx-session', () => { expect(txcWork.invocations).toBe(1) expect(await countNodes('Hi')).toBe(0) - }) + }, 60000) it('should fail even after a transient error', async () => { if (protocolVersion < 4.0) { @@ -231,7 +227,7 @@ describe('#integration rx-session', () => { expect(txcWork.invocations).toBe(2) expect(await countNodes('Person')).toBe(0) - }) + }, 60000) async function countNodes (label) { const session = driver.rxSession() diff --git a/test/session.test.js b/test/session.test.js index 21bda7744..52b2d2438 100644 --- a/test/session.test.js +++ b/test/session.test.js @@ -35,7 +35,6 @@ describe('#integration session', () => { let session // eslint-disable-next-line no-unused-vars let protocolVersion - let originalTimeout beforeEach(async () => { driver = neo4j.driver( @@ -43,14 +42,11 @@ describe('#integration session', () => { sharedNeo4j.authToken ) session = driver.session() - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 70000 protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver) }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await driver.close() }) @@ -59,7 +55,7 @@ describe('#integration session', () => { const session = newSessionWithConnection(connection) session.close().then(() => done()) - }) + }, 70000) it('close should return promise even when already closed ', done => { const connection = new FakeConnection() @@ -72,7 +68,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('close should be idempotent ', done => { const connection = new FakeConnection() @@ -90,7 +86,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should close transaction executor', done => { const session = newSessionWithConnection(new FakeConnection()) @@ -107,7 +103,7 @@ describe('#integration session', () => { expect(closeCalledTimes).toEqual(1) done() }) - }) + }, 70000) it('should be possible to close driver after closing session with failed tx ', done => { const driver = neo4j.driver( @@ -124,7 +120,7 @@ describe('#integration session', () => { .then(() => done()) }) }) - }) + }, 70000) it('should expose basic run/subscribe ', done => { // Given @@ -141,7 +137,7 @@ describe('#integration session', () => { done() } }) - }) + }, 70000) it('should keep context in subscribe methods ', done => { // Given @@ -161,7 +157,7 @@ describe('#integration session', () => { // When & Then session.run('RETURN 1.0 AS a').subscribe(new MyObserver()) - }) + }, 70000) it('should call observers onError on error ', done => { // When & Then @@ -171,7 +167,7 @@ describe('#integration session', () => { done() } }) - }) + }, 70000) it('should accept a query object ', done => { // Given @@ -192,7 +188,7 @@ describe('#integration session', () => { done() } }) - }) + }, 70000) it('should expose run/then/then/then ', done => { // When & Then @@ -208,7 +204,7 @@ describe('#integration session', () => { expect(result.records[0].get('a')).toBe(1) }) .then(done) - }) + }, 70000) it('should expose basic run/catch ', done => { // When & Then @@ -216,7 +212,7 @@ describe('#integration session', () => { expect(error.code).toEqual('Neo.ClientError.Statement.SyntaxError') done() }) - }) + }, 70000) it('should expose summarize method for basic metadata ', done => { // Given @@ -232,7 +228,7 @@ describe('#integration session', () => { expect(sum.queryType).toBe(queryType.READ_WRITE) done() }) - }) + }, 70000) it('should expose server info on successful query', done => { // Given @@ -246,7 +242,7 @@ describe('#integration session', () => { expect(sum.server.version).toBeDefined() done() }) - }) + }, 70000) it('should expose execution time information', done => { // Given @@ -260,7 +256,7 @@ describe('#integration session', () => { expect(sum.resultConsumedAfter.toInt()).not.toBeLessThan(0) done() }) - }) + }, 70000) it('should expose empty parameter map on call with no parameters', done => { // Given @@ -271,7 +267,7 @@ describe('#integration session', () => { expect(sum.query.parameters).toEqual({}) done() }) - }) + }, 70000) it('should expose plan ', done => { // Given @@ -288,7 +284,7 @@ describe('#integration session', () => { expect(sum.plan.children[0].operatorType).toBeDefined() done() }) - }) + }, 70000) it('should expose profile ', done => { // Given @@ -306,7 +302,7 @@ describe('#integration session', () => { expect(sum.profile.rows).toBe(0) done() }) - }) + }, 70000) it('should expose cypher notifications ', done => { // Given @@ -322,7 +318,7 @@ describe('#integration session', () => { expect(sum.notifications[0].position.column).toBeGreaterThan(0) done() }) - }) + }, 70000) it('should fail when using the session with an open transaction', done => { // When @@ -337,7 +333,7 @@ describe('#integration session', () => { ) done() }) - }) + }, 70000) it('should fail when opening multiple transactions', () => { // When @@ -347,7 +343,7 @@ describe('#integration session', () => { expect(() => session.beginTransaction()).toThrowError( /You cannot begin a transaction on a session with an open transaction/ ) - }) + }, 70000) it('should return lots of data', done => { session @@ -367,7 +363,7 @@ describe('#integration session', () => { } }) }) - }) + }, 70000) it('should be able to close a long running query ', done => { // given a long running query @@ -398,7 +394,7 @@ describe('#integration session', () => { setTimeout(() => { session.close() }, 1000) - }) + }, 70000) /* flaky it('should fail nicely on unpackable values ', done => { @@ -427,7 +423,7 @@ describe('#integration session', () => { expect(() => session.run({ query: 'CREATE ()' })).toThrowError(TypeError) expect(() => session.run({ cypher: 'CREATE ()' })).toThrowError(TypeError) - }) + }, 70000) it('should fail nicely for illegal bookmark', () => { expect(() => session.beginTransaction(42)).toThrowError(TypeError) @@ -436,33 +432,41 @@ describe('#integration session', () => { expect(() => session.beginTransaction(() => ['bookmark:1', 'bookmark:2', 'bookmark:3']) ).toThrowError(TypeError) - }) - - it('should allow creation of a ' + neo4j.session.READ + ' session', done => { - const readSession = driver.session({ - defaultAccessMode: neo4j.session.READ - }) - readSession - .run('RETURN 1') - .then(() => readSession.close()) - .then(() => done()) - }) + }, 70000) - it('should allow creation of a ' + neo4j.session.WRITE + ' session', done => { - const writeSession = driver.session({ - defaultAccessMode: neo4j.session.WRITE - }) - writeSession - .run('CREATE ()') - .then(() => writeSession.close()) - .then(() => done()) - }) + it( + 'should allow creation of a ' + neo4j.session.READ + ' session', + done => { + const readSession = driver.session({ + defaultAccessMode: neo4j.session.READ + }) + readSession + .run('RETURN 1') + .then(() => readSession.close()) + .then(() => done()) + }, + 70000 + ) + + it( + 'should allow creation of a ' + neo4j.session.WRITE + ' session', + done => { + const writeSession = driver.session({ + defaultAccessMode: neo4j.session.WRITE + }) + writeSession + .run('CREATE ()') + .then(() => writeSession.close()) + .then(() => done()) + }, + 70000 + ) it('should fail for illegal session mode', () => { expect(() => driver.session({ defaultAccessMode: 'ILLEGAL_MODE' }) ).toThrow() - }) + }, 70000) it('should release connection to the pool after run', done => { withQueryInTmpSession(driver, () => { @@ -474,7 +478,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should release connection to the pool after run failure', done => { withQueryInTmpSession(driver, () => { @@ -486,7 +490,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should release connection to the pool when result is consumed', done => { withQueryInTmpSession(driver, () => { @@ -506,7 +510,7 @@ describe('#integration session', () => { } }) }) - }) + }, 70000) it('should release connection to the pool when result fails', done => { withQueryInTmpSession(driver, () => { @@ -524,7 +528,7 @@ describe('#integration session', () => { onCompleted: () => {} }) }) - }) + }, 70000) it('should release connection to the pool when transaction commits', done => { withQueryInTmpSession(driver, () => { @@ -549,7 +553,7 @@ describe('#integration session', () => { } }) }) - }) + }, 70000) it('should release connection to the pool when transaction rolls back', done => { withQueryInTmpSession(driver, () => { @@ -574,7 +578,7 @@ describe('#integration session', () => { } }) }) - }) + }, 70000) it('should update last bookmark after every read tx commit', done => { // new session without initial bookmark @@ -592,7 +596,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should update last bookmark after every write tx commit', done => { const bookmarkBefore = session.lastBookmark() @@ -608,7 +612,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should not lose last bookmark after run', done => { const tx = session.beginTransaction() @@ -623,7 +627,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should commit read transaction', done => { // new session without initial bookmark @@ -640,7 +644,7 @@ describe('#integration session', () => { verifyBookmark(session.lastBookmark()) done() }) - }) + }, 70000) it('should commit write transaction', done => { const bookmarkBefore = session.lastBookmark() @@ -662,7 +666,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should not commit already committed read transaction', done => { const resultPromise = session.readTransaction(tx => { @@ -691,7 +695,7 @@ describe('#integration session', () => { done() }) - }) + }, 70000) it('should not commit already committed write transaction', done => { const resultPromise = session.writeTransaction(tx => { @@ -724,7 +728,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should not commit rolled back read transaction', done => { const bookmarkBefore = session.lastBookmark() @@ -749,7 +753,7 @@ describe('#integration session', () => { done() }) - }) + }, 70000) it('should not commit rolled back write transaction', done => { const bookmarkBefore = session.lastBookmark() @@ -778,7 +782,7 @@ describe('#integration session', () => { done() }) }) - }) + }, 70000) it('should interrupt query waiting on a lock when closed', done => { session.run('CREATE ()').then(() => { @@ -812,7 +816,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should interrupt transaction waiting on a lock when closed', done => { session.run('CREATE ()').then(() => { @@ -845,7 +849,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should interrupt transaction function waiting on a lock when closed', done => { session.run('CREATE ()').then(() => { @@ -881,7 +885,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should send multiple bookmarks', async () => { const nodeCount = 17 @@ -902,7 +906,7 @@ describe('#integration session', () => { } finally { await session.close() } - }) + }, 70000) it('should acquire connection for transaction', done => { expect(numberOfAcquiredConnectionsFromPool()).toEqual(0) @@ -943,7 +947,7 @@ describe('#integration session', () => { }) }) }) - }) + }, 70000) it('should acquire connection for query execution', done => { session.run('RETURN 42 AS answer').subscribe({ @@ -960,7 +964,7 @@ describe('#integration session', () => { console.log(error) } }) - }) + }, 70000) it('should acquire separate connections for transaction and query execution in different sessions', done => { const otherSession = driver.session() @@ -978,15 +982,15 @@ describe('#integration session', () => { console.log(error) } }) - }) + }, 70000) it('should respect connection timeout', done => { testConnectionTimeout(false, done) - }) + }, 70000) it('should respect encrypted connection timeout', done => { testConnectionTimeout(true, done) - }) + }, 70000) it('should convert iterable to array', done => { const iterable = {} @@ -1008,7 +1012,7 @@ describe('#integration session', () => { .catch(error => { done.fail(error) }) - }) + }, 70000) /* flaky it('should fail to convert illegal iterable to array', done => { @@ -1036,7 +1040,7 @@ describe('#integration session', () => { expect(() => session.run('RETURN $value', '42')).toThrowError(TypeError) expect(() => session.run('RETURN $value', 42)).toThrowError(TypeError) expect(() => session.run('RETURN $value', () => 42)).toThrowError(TypeError) - }) + }, 70000) /* flaky it('should fail to pass node as a query parameter', done => { @@ -1078,7 +1082,7 @@ describe('#integration session', () => { testTransactionRetryUntilSuccess(() => { throw newError('Error that can be retried', SESSION_EXPIRED) }, done) - }) + }, 70000) it('should retry transaction until success when function returns rejected promise', done => { testTransactionRetryUntilSuccess( @@ -1086,13 +1090,13 @@ describe('#integration session', () => { Promise.reject(newError('Error that can be retried', SESSION_EXPIRED)), done ) - }) + }, 70000) it('should not retry transaction when function throws fatal error', done => { testTransactionRetryOnFatalError(() => { throw newError('Error that is fatal', PROTOCOL_ERROR) }, done) - }) + }, 70000) it('should not retry transaction when function returns promise rejected with fatal error', done => { testTransactionRetryOnFatalError( @@ -1100,7 +1104,7 @@ describe('#integration session', () => { Promise.reject(newError('Error that is fatal', 'ReallyFatalErrorCode')), done ) - }) + }, 70000) function testTransactionRetryUntilSuccess (failureResponseFunction, done) { const session = driver.session() diff --git a/test/stress.test.js b/test/stress.test.js index 0fe1842ca..a8ab511ad 100644 --- a/test/stress.test.js +++ b/test/stress.test.js @@ -71,14 +71,10 @@ describe('#integration stress tests', () => { const LOGGING_ENABLED = fromEnvOrDefault('STRESS_TEST_LOGGING_ENABLED', false) - let originalTimeout let driver let protocolVersion beforeEach(async () => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = TEST_MODE.maxRunTimeMs - const config = { logging: neo4j.logging.console(LOGGING_ENABLED ? 'debug' : 'info'), encrypted: isRemoteCluster() @@ -93,7 +89,6 @@ describe('#integration stress tests', () => { }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await driver.close() }) diff --git a/test/temporal-types.test.js b/test/temporal-types.test.js index 0e1919a9d..387e7c31b 100644 --- a/test/temporal-types.test.js +++ b/test/temporal-types.test.js @@ -48,16 +48,12 @@ const MAX_ZONE_ID = 'Etc/GMT-14' const ZONE_IDS = ['Europe/Zaporozhye', 'Europe/London', 'UTC', 'Africa/Cairo'] describe('#integration temporal-types', () => { - let originalTimeout let driver let driverWithNativeNumbers let session let protocolVersion beforeAll(() => { - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - driver = neo4j.driver( `bolt://${sharedNeo4j.hostname}`, sharedNeo4j.authToken @@ -70,8 +66,6 @@ describe('#integration temporal-types', () => { }) afterAll(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - if (driver) { await driver.close() driver = null @@ -105,7 +99,7 @@ describe('#integration temporal-types', () => { 'RETURN duration({years: 2, months: 3, days: 17, seconds: 91, nanoseconds: 999})', expectedValue ) - }) + }, 60000) it('should send and receive random Duration', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -113,7 +107,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveRandomTemporalValues(() => randomDuration()) - }) + }, 60000) it('should send and receive Duration when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -124,7 +118,7 @@ describe('#integration temporal-types', () => { await testSendReceiveTemporalValue( new neo4j.types.Duration(4, 15, 931, 99953) ) - }) + }, 60000) it('should send and receive array of Duration', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -132,7 +126,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveArrayOfRandomTemporalValues(() => randomDuration()) - }) + }, 60000) it('should receive LocalTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -144,7 +138,7 @@ describe('#integration temporal-types', () => { 'RETURN localtime({hour: 22, minute: 59, second: 10, nanosecond: 999999})', expectedValue ) - }) + }, 60000) it('should send and receive max LocalTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -153,7 +147,7 @@ describe('#integration temporal-types', () => { const maxLocalTime = localTime(23, 59, 59, MAX_NANO_OF_SECOND) await testSendReceiveTemporalValue(maxLocalTime) - }) + }, 60000) it('should send and receive min LocalTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -162,7 +156,7 @@ describe('#integration temporal-types', () => { const minLocalTime = localTime(0, 0, 0, 0) await testSendReceiveTemporalValue(minLocalTime) - }) + }, 60000) it('should send and receive LocalTime when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -173,7 +167,7 @@ describe('#integration temporal-types', () => { await testSendReceiveTemporalValue( new neo4j.types.LocalTime(12, 32, 56, 12345) ) - }) + }, 60000) it('should send and receive random LocalTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -181,7 +175,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveRandomTemporalValues(() => randomLocalTime()) - }) + }, 60000) it('should send and receive array of LocalTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -189,7 +183,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveArrayOfRandomTemporalValues(() => randomLocalTime()) - }) + }, 60000) it('should receive Time', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -201,7 +195,7 @@ describe('#integration temporal-types', () => { 'RETURN time({hour: 11, minute: 42, second: 59, nanosecond: 9999, timezone:"-08:30"})', expectedValue ) - }) + }, 60000) it('should send and receive max Time', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -210,7 +204,7 @@ describe('#integration temporal-types', () => { const maxTime = time(23, 59, 59, MAX_NANO_OF_SECOND, MAX_TIME_ZONE_OFFSET) await testSendReceiveTemporalValue(maxTime) - }) + }, 60000) it('should send and receive min Time', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -219,7 +213,7 @@ describe('#integration temporal-types', () => { const minTime = time(0, 0, 0, 0, MIN_TIME_ZONE_OFFSET) await testSendReceiveTemporalValue(minTime) - }) + }, 60000) it('should send and receive Time when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -230,7 +224,7 @@ describe('#integration temporal-types', () => { await testSendReceiveTemporalValue( new neo4j.types.Time(22, 19, 32, 18381, MAX_TIME_ZONE_OFFSET) ) - }) + }, 60000) it('should send and receive random Time', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -238,7 +232,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveRandomTemporalValues(() => randomTime()) - }) + }, 60000) it('should send and receive array of Time', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -246,7 +240,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveArrayOfRandomTemporalValues(() => randomTime()) - }) + }, 60000) it('should receive Date', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -258,7 +252,7 @@ describe('#integration temporal-types', () => { 'RETURN date({year: 1995, month: 7, day: 28})', expectedValue ) - }) + }, 60000) it('should send and receive max Date', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -267,7 +261,7 @@ describe('#integration temporal-types', () => { const maxDate = date(MAX_YEAR, 12, 31) await testSendReceiveTemporalValue(maxDate) - }) + }, 60000) it('should send and receive min Date', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -276,7 +270,7 @@ describe('#integration temporal-types', () => { const minDate = date(MIN_YEAR, 1, 1) await testSendReceiveTemporalValue(minDate) - }) + }, 60000) it('should send and receive Date when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -285,7 +279,7 @@ describe('#integration temporal-types', () => { session = driverWithNativeNumbers.session() await testSendReceiveTemporalValue(new neo4j.types.Date(1923, 8, 14)) - }) + }, 60000) it('should send and receive random Date', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -293,7 +287,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveRandomTemporalValues(() => randomDate()) - }) + }, 60000) it('should send and receive array of Date', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -301,7 +295,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveArrayOfRandomTemporalValues(() => randomDate()) - }) + }, 60000) it('should receive LocalDateTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -313,7 +307,7 @@ describe('#integration temporal-types', () => { 'RETURN localdatetime({year: 1869, month: 9, day: 23, hour: 18, minute: 29, second: 59, nanosecond: 12349})', expectedValue ) - }) + }, 60000) it('should send and receive max LocalDateTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -330,7 +324,7 @@ describe('#integration temporal-types', () => { MAX_NANO_OF_SECOND ) await testSendReceiveTemporalValue(maxLocalDateTime) - }) + }, 60000) it('should send and receive min LocalDateTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -339,7 +333,7 @@ describe('#integration temporal-types', () => { const minLocalDateTime = localDateTime(MIN_YEAR, 1, 1, 0, 0, 0, 0) await testSendReceiveTemporalValue(minLocalDateTime) - }) + }, 60000) it('should send and receive LocalDateTime when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -350,7 +344,7 @@ describe('#integration temporal-types', () => { await testSendReceiveTemporalValue( new neo4j.types.LocalDateTime(2045, 9, 1, 11, 25, 25, 911) ) - }) + }, 60000) it('should send and receive random LocalDateTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -358,7 +352,7 @@ describe('#integration temporal-types', () => { } await testSendAndReceiveRandomTemporalValues(() => randomLocalDateTime()) - }) + }, 60000) it('should send and receive random LocalDateTime', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -368,7 +362,7 @@ describe('#integration temporal-types', () => { await testSendAndReceiveArrayOfRandomTemporalValues(() => randomLocalDateTime() ) - }) + }, 60000) it('should receive DateTime with time zone offset', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -389,7 +383,7 @@ describe('#integration temporal-types', () => { 'RETURN datetime({year: 1992, month: 11, day: 24, hour: 9, minute: 55, second: 42, nanosecond: 999, timezone: "+05:00"})', expectedValue ) - }) + }, 60000) it('should send and receive max DateTime with zone offset', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -407,7 +401,7 @@ describe('#integration temporal-types', () => { MAX_TIME_ZONE_OFFSET ) await testSendReceiveTemporalValue(maxDateTime) - }) + }, 60000) it('should send and receive min DateTime with zone offset', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -425,7 +419,7 @@ describe('#integration temporal-types', () => { MAX_TIME_ZONE_OFFSET ) await testSendReceiveTemporalValue(minDateTime) - }) + }, 60000) it('should send and receive DateTime with zone offset when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -446,7 +440,7 @@ describe('#integration temporal-types', () => { null ) ) - }) + }, 60000) it('should send and receive random DateTime with zone offset', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -456,7 +450,7 @@ describe('#integration temporal-types', () => { await testSendAndReceiveRandomTemporalValues(() => randomDateTimeWithZoneOffset() ) - }) + }, 60000) it('should send and receive array of DateTime with zone offset', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -466,7 +460,7 @@ describe('#integration temporal-types', () => { await testSendAndReceiveArrayOfRandomTemporalValues(() => randomDateTimeWithZoneOffset() ) - }) + }, 60000) it('should receive DateTime with zone id', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -487,7 +481,7 @@ describe('#integration temporal-types', () => { 'RETURN datetime({year: 1992, month: 11, day: 24, hour: 9, minute: 55, second: 42, nanosecond: 999, timezone: "Europe/Stockholm"})', expectedValue ) - }) + }, 60000) it('should send and receive max DateTime with zone id', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -505,7 +499,7 @@ describe('#integration temporal-types', () => { MAX_ZONE_ID ) await testSendReceiveTemporalValue(maxDateTime) - }) + }, 60000) it('should send and receive min DateTime with zone id', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -523,7 +517,7 @@ describe('#integration temporal-types', () => { MIN_ZONE_ID ) await testSendReceiveTemporalValue(minDateTime) - }) + }, 60000) it('should send and receive DateTime with zone id when disableLosslessIntegers=true', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -544,7 +538,7 @@ describe('#integration temporal-types', () => { 'Europe/Stockholm' ) ) - }) + }, 60000) it('should send and receive random DateTime with zone id', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -554,7 +548,7 @@ describe('#integration temporal-types', () => { await testSendAndReceiveRandomTemporalValues(() => randomDateTimeWithZoneId() ) - }) + }, 60000) it('should send and receive array of DateTime with zone id', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -564,7 +558,7 @@ describe('#integration temporal-types', () => { await testSendAndReceiveArrayOfRandomTemporalValues(() => randomDateTimeWithZoneId() ) - }) + }, 60000) it('should convert Duration to ISO string', () => { expect(duration(13, 62, 3, 999111999).toString()).toEqual( @@ -572,7 +566,7 @@ describe('#integration temporal-types', () => { ) expect(duration(0, 0, 0, 0).toString()).toEqual('P0M0DT0S') expect(duration(-1, -2, 10, 10).toString()).toEqual('P-1M-2DT10.000000010S') - }) + }, 60000) it('should convert LocalTime to ISO string', () => { expect(localTime(12, 19, 39, 111222333).toString()).toEqual( @@ -580,7 +574,7 @@ describe('#integration temporal-types', () => { ) expect(localTime(3, 59, 2, 17).toString()).toEqual('03:59:02.000000017') expect(localTime(0, 0, 0, 0).toString()).toEqual('00:00:00') - }) + }, 60000) it('should convert Time to ISO string', () => { expect(time(11, 45, 22, 333222111, 9015).toString()).toEqual( @@ -591,14 +585,14 @@ describe('#integration temporal-types', () => { expect(time(21, 59, 0, 123, -25200).toString()).toEqual( '21:59:00.000000123-07:00' ) - }) + }, 60000) it('should convert Date to ISO string', () => { expect(date(2015, 10, 12).toString()).toEqual('2015-10-12') expect(date(881, 1, 1).toString()).toEqual('0881-01-01') expect(date(-999, 12, 24).toString()).toEqual('-0999-12-24') expect(date(-9, 1, 1).toString()).toEqual('-0009-01-01') - }) + }, 60000) it('should convert LocalDateTime to ISO string', () => { expect(localDateTime(1992, 11, 8, 9, 42, 17, 22).toString()).toEqual( @@ -610,7 +604,7 @@ describe('#integration temporal-types', () => { expect(localDateTime(0, 1, 1, 0, 0, 0, 1).toString()).toEqual( '0000-01-01T00:00:00.000000001' ) - }) + }, 60000) it('should convert DateTime with time zone offset to ISO string', () => { expect( @@ -622,7 +616,7 @@ describe('#integration temporal-types', () => { expect( dateTimeWithZoneOffset(-3, 3, 9, 9, 33, 27, 999000, 15300).toString() ).toEqual('-0003-03-09T09:33:27.000999000+04:15') - }) + }, 60000) it('should convert DateTime with time zone id to ISO-like string', () => { expect( @@ -652,7 +646,7 @@ describe('#integration temporal-types', () => { expect( dateTimeWithZoneId(248, 12, 30, 23, 59, 59, 3, 'CET').toString() ).toEqual('0248-12-30T23:59:59.000000003[CET]') - }) + }, 60000) it('should expose local time components in time', () => { const offsetTime = time(22, 12, 58, 999111222, 42) @@ -661,7 +655,7 @@ describe('#integration temporal-types', () => { expect(offsetTime.minute).toEqual(neo4j.int(12)) expect(offsetTime.second).toEqual(neo4j.int(58)) expect(offsetTime.nanosecond).toEqual(neo4j.int(999111222)) - }) + }, 60000) it('should expose local date and time components in local date-time', () => { const dateTime = localDateTime(2025, 9, 18, 23, 22, 21, 2020) @@ -674,7 +668,7 @@ describe('#integration temporal-types', () => { expect(dateTime.minute).toEqual(neo4j.int(22)) expect(dateTime.second).toEqual(neo4j.int(21)) expect(dateTime.nanosecond).toEqual(neo4j.int(2020)) - }) + }, 60000) it('should expose local date-time components in date-time with zone offset', () => { const zonedDateTime = dateTimeWithZoneOffset( @@ -696,7 +690,7 @@ describe('#integration temporal-types', () => { expect(zonedDateTime.minute).toEqual(neo4j.int(37)) expect(zonedDateTime.second).toEqual(neo4j.int(59)) expect(zonedDateTime.nanosecond).toEqual(neo4j.int(875387)) - }) + }, 60000) it('should expose local date-time components in date-time with zone ID', () => { const zonedDateTime = dateTimeWithZoneId( @@ -718,7 +712,7 @@ describe('#integration temporal-types', () => { expect(zonedDateTime.minute).toEqual(neo4j.int(32)) expect(zonedDateTime.second).toEqual(neo4j.int(11)) expect(zonedDateTime.nanosecond).toEqual(neo4j.int(9346458)) - }) + }, 60000) it('should format duration to string', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -836,7 +830,7 @@ describe('#integration temporal-types', () => { expectedString: 'P0M0DT-42.123456789S' } ]) - }) + }, 60000) it('should normalize created duration', () => { const duration1 = duration(0, 0, 1, 1000000000) @@ -862,7 +856,7 @@ describe('#integration temporal-types', () => { const duration6 = duration(0, 0, 40, -12123456999) expect(duration6.seconds).toEqual(neo4j.int(27)) expect(duration6.nanoseconds).toEqual(neo4j.int(876543001)) - }) + }, 60000) it('should validate types of constructor arguments for Duration', () => { expect(() => new neo4j.types.Duration('1', 2, 3, 4)).toThrowError(TypeError) @@ -880,7 +874,7 @@ describe('#integration temporal-types', () => { nanoseconds: 4 }) ).toThrowError(TypeError) - }) + }, 60000) it('should validate types of constructor arguments for LocalTime', () => { expect(() => new neo4j.types.LocalTime('1', 2, 3, 4)).toThrowError( @@ -904,7 +898,7 @@ describe('#integration temporal-types', () => { nanosecond: 4 }) ).toThrowError(TypeError) - }) + }, 60000) it('should validate types of constructor arguments for Time', () => { expect(() => new neo4j.types.Time('1', 2, 3, 4, 5)).toThrowError(TypeError) @@ -926,7 +920,7 @@ describe('#integration temporal-types', () => { timeZoneOffsetSeconds: 5 }) ).toThrowError(TypeError) - }) + }, 60000) it('should validate types of constructor arguments for Date', () => { expect(() => new neo4j.types.Date('1', 2, 3)).toThrowError(TypeError) @@ -935,7 +929,7 @@ describe('#integration temporal-types', () => { expect( () => new neo4j.types.Date({ year: 1, month: 2, day: 3 }) ).toThrowError(TypeError) - }) + }, 60000) it('should validate types of constructor arguments for LocalDateTime', () => { expect( @@ -971,7 +965,7 @@ describe('#integration temporal-types', () => { nanosecond: 7 }) ).toThrowError(TypeError) - }) + }, 60000) it('should validate types of constructor arguments for DateTime', () => { expect( @@ -1016,7 +1010,7 @@ describe('#integration temporal-types', () => { expect( () => new neo4j.types.DateTime(1, 2, 3, 4, 5, 6, 7, 8, 'UK') ).toThrow() - }) + }, 60000) it('should convert standard Date to neo4j LocalTime', () => { testStandardDateToLocalTimeConversion(new Date(2000, 1, 1, 0, 0, 0, 0)) @@ -1038,7 +1032,7 @@ describe('#integration temporal-types', () => { new Date(2222, 3, 29, 0, 0, 0, 0), neo4j.int(999999999) ) - }) + }, 60000) it('should fail to convert invalid standard Date to neo4j LocalTime', () => { const LocalTime = neo4j.types.LocalTime @@ -1068,7 +1062,7 @@ describe('#integration temporal-types', () => { expect(() => LocalTime.fromStandardDate(new Date(), [1])).toThrowError( TypeError ) - }) + }, 60000) it('should convert standard Date to neo4j Time', () => { testStandardDateToTimeConversion(new Date(2000, 1, 1, 0, 0, 0, 0)) @@ -1090,7 +1084,7 @@ describe('#integration temporal-types', () => { new Date(2222, 3, 29, 0, 0, 0, 0), neo4j.int(999999999) ) - }) + }, 60000) it('should fail to convert invalid standard Date to neo4j Time', () => { const Time = neo4j.types.Time @@ -1110,7 +1104,7 @@ describe('#integration temporal-types', () => { Time.fromStandardDate(new Date(), { nanosecond: 1 }) ).toThrowError(TypeError) expect(() => Time.fromStandardDate(new Date(), [1])).toThrowError(TypeError) - }) + }, 60000) it('should convert standard Date to neo4j Date', () => { testStandardDateToNeo4jDateConversion(new Date(2000, 1, 1)) @@ -1125,7 +1119,7 @@ describe('#integration temporal-types', () => { testStandardDateToNeo4jDateConversion(new Date(2222, 3, 29)) testStandardDateToNeo4jDateConversion(new Date(1567, 0, 29)) - }) + }, 60000) it('should fail to convert invalid standard Date to neo4j Date', () => { const Neo4jDate = neo4j.types.Date @@ -1145,7 +1139,7 @@ describe('#integration temporal-types', () => { expect(() => Neo4jDate.fromStandardDate(new Date(NaN))).toThrowError( TypeError ) - }) + }, 60000) it('should convert standard Date to neo4j LocalDateTime', () => { testStandardDateToLocalDateTimeConversion(new Date(2011, 9, 18)) @@ -1169,7 +1163,7 @@ describe('#integration temporal-types', () => { testStandardDateToLocalDateTimeConversion(new Date(2192, 0, 17, 20, 30, 40)) testStandardDateToLocalDateTimeConversion(new Date(2239, 0, 9, 1, 2, 3), 4) - }) + }, 60000) it('should fail to convert invalid standard Date to neo4j LocalDateTime', () => { const LocalDateTime = neo4j.types.LocalDateTime @@ -1199,7 +1193,7 @@ describe('#integration temporal-types', () => { expect(() => LocalDateTime.fromStandardDate(new Date(), [1])).toThrowError( TypeError ) - }) + }, 60000) it('should convert standard Date to neo4j DateTime', () => { testStandardDateToDateTimeConversion(new Date(2011, 9, 18)) @@ -1221,7 +1215,7 @@ describe('#integration temporal-types', () => { testStandardDateToDateTimeConversion(new Date(1899, 0, 7, 7, 7, 7, 7)) testStandardDateToDateTimeConversion(new Date(2005, 0, 1, 2, 3, 4, 5), 100) - }) + }, 60000) it('should fail to convert invalid standard Date to neo4j DateTime', () => { const DateTime = neo4j.types.DateTime @@ -1251,7 +1245,7 @@ describe('#integration temporal-types', () => { expect(() => DateTime.fromStandardDate(new Date(), [1])).toThrowError( TypeError ) - }) + }, 60000) it('should send and receive neo4j Date created from standard Date with zero month', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -1264,7 +1258,7 @@ describe('#integration temporal-types', () => { const standardDate = new Date(2000, 0, 1) const neo4jDate = neo4j.types.Date.fromStandardDate(standardDate) await testSendReceiveTemporalValue(neo4jDate) - }) + }, 60000) it('should send and receive neo4j LocalDateTime created from standard Date with zero month', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -1279,7 +1273,7 @@ describe('#integration temporal-types', () => { standardDate ) await testSendReceiveTemporalValue(neo4jLocalDateTime) - }) + }, 60000) it('should send and receive neo4j DateTime created from standard Date with zero month', async () => { if (neo4jDoesNotSupportTemporalTypes()) { @@ -1292,7 +1286,7 @@ describe('#integration temporal-types', () => { const standardDate = new Date(1756, 0, 29, 23, 15, 59, 12) const neo4jDateTime = neo4j.types.DateTime.fromStandardDate(standardDate) await testSendReceiveTemporalValue(neo4jDateTime) - }) + }, 60000) it('should fail to create LocalTime with out of range values', () => { expect(() => localTime(999, 1, 1, 1)).toThrow() @@ -1300,7 +1294,7 @@ describe('#integration temporal-types', () => { expect(() => localTime(1, 1, 999, 1)).toThrow() expect(() => localTime(1, 1, 1, -999)).toThrow() expect(() => localTime(1, 1, 1, 1000000000)).toThrow() - }) + }, 60000) it('should fail to create Time with out of range values', () => { expect(() => time(999, 1, 1, 1, 1)).toThrow() @@ -1308,7 +1302,7 @@ describe('#integration temporal-types', () => { expect(() => time(1, 1, 999, 1, 1)).toThrow() expect(() => time(1, 1, 1, -999, 1)).toThrow() expect(() => time(1, 1, 1, 1000000000, 1)).toThrow() - }) + }, 60000) it('should fail to create Date with out of range values', () => { expect(() => date(1000000000, 1, 1)).toThrow() @@ -1317,7 +1311,7 @@ describe('#integration temporal-types', () => { expect(() => date(1, 1, 0)).toThrow() expect(() => date(1, 1, -1)).toThrow() expect(() => date(1, 1, 33)).toThrow() - }) + }, 60000) it('should fail to create LocalDateTime with out of range values', () => { expect(() => localDateTime(1000000000, 1, 1, 1, 1, 1, 1)).toThrow() @@ -1338,7 +1332,7 @@ describe('#integration temporal-types', () => { expect(() => localDateTime(1, 1, 1, 1, 1, 99, 1)).toThrow() expect(() => localDateTime(1, 1, 1, 1, 1, 1, -1)).toThrow() expect(() => localDateTime(1, 1, 1, 1, 1, 1, 1000000000)).toThrow() - }) + }, 60000) it('should fail to create DateTime with out of range values', () => { expect(() => @@ -1363,7 +1357,7 @@ describe('#integration temporal-types', () => { expect(() => dateTimeWithZoneOffset(1, 1, 1, 1, 1, 1, 1000000000, 0) ).toThrow() - }) + }, 60000) it('should convert standard Date with offset to neo4j Time', () => { const standardDate1 = testUtils.fakeStandardDateWithOffset(0) @@ -1385,7 +1379,7 @@ describe('#integration temporal-types', () => { const standardDate5 = testUtils.fakeStandardDateWithOffset(150) const neo4jTime5 = neo4j.types.Time.fromStandardDate(standardDate5) verifyTimeZoneOffset(neo4jTime5, -1 * 150 * 60, '-02:30') - }) + }, 60000) it('should convert standard Date with offset to neo4j DateTime', () => { const standardDate1 = testUtils.fakeStandardDateWithOffset(0) @@ -1407,7 +1401,7 @@ describe('#integration temporal-types', () => { const standardDate5 = testUtils.fakeStandardDateWithOffset(150) const neo4jDateTime5 = neo4j.types.DateTime.fromStandardDate(standardDate5) verifyTimeZoneOffset(neo4jDateTime5, -1 * 150 * 60, '-02:30') - }) + }, 60000) function testSendAndReceiveRandomTemporalValues (valueGenerator) { const asyncFunction = (index, callback) => { diff --git a/test/transaction.test.js b/test/transaction.test.js index 70c155b8d..ed0b397f1 100644 --- a/test/transaction.test.js +++ b/test/transaction.test.js @@ -19,7 +19,6 @@ import neo4j from '../src' import sharedNeo4j from './internal/shared-neo4j' import { ServerVersion } from '../src/internal/server-version' -import TxConfig from '../src/internal/tx-config' import { READ } from '../src/driver' describe('#integration transaction', () => { @@ -27,13 +26,8 @@ describe('#integration transaction', () => { let session // eslint-disable-next-line no-unused-vars let serverVersion - let originalTimeout beforeEach(async () => { - // make jasmine timeout high enough to test unreachable bookmarks - originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - driver = neo4j.driver( `bolt://${sharedNeo4j.hostname}`, sharedNeo4j.authToken @@ -45,7 +39,6 @@ describe('#integration transaction', () => { }) afterEach(async () => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout await session.close() await driver.close() }) @@ -75,7 +68,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should populate resultAvailableAfter for transaction#run', done => { const tx = session.beginTransaction() @@ -92,7 +85,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should handle interactive session', done => { const tx = session.beginTransaction() @@ -117,7 +110,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should handle failures with subscribe', done => { const tx = session.beginTransaction() @@ -125,7 +118,7 @@ describe('#integration transaction', () => { expect(error.code).toEqual('Neo.ClientError.Statement.SyntaxError') done() }) - }) + }, 60000) it('should handle failures with catch', done => { const tx = session.beginTransaction() @@ -135,7 +128,7 @@ describe('#integration transaction', () => { done() } }) - }) + }, 60000) it('should handle failures on commit', async () => { // When @@ -161,7 +154,7 @@ describe('#integration transaction', () => { ) }) ) - }) + }, 60000) it('should fail when committing on a failed query', async () => { const tx = session.beginTransaction() @@ -178,7 +171,7 @@ describe('#integration transaction', () => { ) }) ) - }) + }, 60000) it('should handle when committing when another query fails', async () => { // When @@ -195,7 +188,7 @@ describe('#integration transaction', () => { message: jasmine.stringMatching(/Cannot commit this transaction/) }) ) - }) + }, 60000) it('should handle rollbacks', done => { const tx = session.beginTransaction() @@ -222,7 +215,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should fail when committing on a rolled back query', async () => { const tx = session.beginTransaction() @@ -236,7 +229,7 @@ describe('#integration transaction', () => { ) }) ) - }) + }, 60000) it('should fail when running on a rolled back transaction', async () => { const tx = session.beginTransaction() @@ -250,7 +243,7 @@ describe('#integration transaction', () => { ) }) ) - }) + }, 60000) it('should fail running when a previous query failed', async () => { const tx = session.beginTransaction() @@ -267,7 +260,7 @@ describe('#integration transaction', () => { }) ) await tx.rollback() - }) + }, 60000) it('should fail when trying to roll back a rolled back transaction', async () => { const tx = session.beginTransaction() @@ -281,7 +274,7 @@ describe('#integration transaction', () => { ) }) ) - }) + }, 60000) it('should provide bookmark on commit', done => { // new session without initial bookmark @@ -301,7 +294,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should have bookmark when tx is rolled back', done => { // new session without initial bookmark @@ -332,7 +325,7 @@ describe('#integration transaction', () => { }) }) }) - }) + }, 60000) it('should have no bookmark when tx fails', done => { // new session without initial bookmark @@ -363,15 +356,15 @@ describe('#integration transaction', () => { }) }) }) - }) + }, 60000) it('should throw when provided string (bookmark) parameter', () => { expect(() => session.beginTransaction('bookmark')).toThrowError(TypeError) - }) + }, 60000) it('should throw when provided string[] (bookmark) parameter', () => { expect(() => session.beginTransaction(['bookmark'])).toThrowError(TypeError) - }) + }, 60000) it('should fail to run query for unreachable bookmark', done => { const tx1 = session.beginTransaction() @@ -403,7 +396,7 @@ describe('#integration transaction', () => { .catch(console.log) }) .catch(console.log) - }) + }, 60000) it('should rollback when very first run fails', done => { const tx1 = session.beginTransaction() @@ -416,7 +409,7 @@ describe('#integration transaction', () => { tx2.commit().then(done) }) }) - }) + }, 60000) it('should rollback when some run fails', done => { const tx1 = session.beginTransaction() @@ -431,7 +424,7 @@ describe('#integration transaction', () => { }) }) }) - }) + }, 60000) it('should fail to commit transaction that had run failures', async () => { const tx1 = session.beginTransaction() @@ -451,7 +444,7 @@ describe('#integration transaction', () => { const tx2 = session.beginTransaction() const result = await tx2.run('MATCH (n:Person) RETURN count(n)') expect(result.records[0].get(0).toNumber()).toEqual(0) - }) + }, 60000) it('should expose server info on successful query', done => { const query = 'RETURN 1' @@ -466,7 +459,7 @@ describe('#integration transaction', () => { tx.commit().then(done) }) .catch(console.log) - }) + }, 60000) it('should expose server info on successful query using observer', done => { // Given @@ -487,7 +480,7 @@ describe('#integration transaction', () => { done() } }) - }) + }, 60000) it('should fail nicely for illegal query', async () => { const tx = session.beginTransaction() @@ -501,7 +494,7 @@ describe('#integration transaction', () => { expect(() => tx.run({ query: 'CREATE ()' })).toThrowError(TypeError) expect(() => tx.run({ cypher: 'CREATE ()' })).toThrowError(TypeError) - }) + }, 60000) it('should accept a query object ', done => { const tx = session.beginTransaction() @@ -514,12 +507,12 @@ describe('#integration transaction', () => { done() }) .catch(console.log) - }) + }, 60000) it('should be open when neither committed nor rolled back', () => { const tx = session.beginTransaction() expect(tx.isOpen()).toBeTruthy() - }) + }, 60000) it('should not be open after commit', done => { const tx = session.beginTransaction() @@ -530,7 +523,7 @@ describe('#integration transaction', () => { done() }) }) - }) + }, 60000) it('should not be open after rollback', done => { const tx = session.beginTransaction() @@ -541,7 +534,7 @@ describe('#integration transaction', () => { done() }) }) - }) + }, 60000) it('should not be open after run error', done => { const tx = session.beginTransaction() @@ -550,15 +543,15 @@ describe('#integration transaction', () => { expect(tx.isOpen()).toBeFalsy() done() }) - }) + }, 60000) it('should respect socket connection timeout', done => { testConnectionTimeout(false, done) - }) + }, 60000) it('should respect TLS socket connection timeout', done => { testConnectionTimeout(true, done) - }) + }, 60000) it('should fail for invalid query parameters', done => { const tx = session.beginTransaction() @@ -568,7 +561,7 @@ describe('#integration transaction', () => { expect(() => tx.run('RETURN $value', () => 'Hello')).toThrowError(TypeError) tx.rollback().then(() => done()) - }) + }, 60000) it('should allow rollback after failure', done => { const tx = session.beginTransaction() @@ -581,21 +574,21 @@ describe('#integration transaction', () => { .catch(error => done.fail(error)) .then(() => done()) }) - }) + }, 60000) it('should return empty promise on commit', async () => { const tx = session.beginTransaction() const result = await tx.commit() expect(result).toBeUndefined() - }) + }, 60000) it('should return empty promise on rollback', async () => { const tx = session.beginTransaction() const result = await tx.rollback() expect(result).toBeUndefined() - }) + }, 60000) it('should reset transaction', async done => { const session = driver.session({ defaultAccessMode: READ }) @@ -612,7 +605,7 @@ describe('#integration transaction', () => { await closePromise done() } - }) + }, 60000) function expectSyntaxError (error) { expect(error.code).toBe('Neo.ClientError.Statement.SyntaxError') diff --git a/test/types.test.js b/test/types.test.js index d64a31013..734a85c59 100644 --- a/test/types.test.js +++ b/test/types.test.js @@ -187,35 +187,25 @@ describe('#integration path values', () => { }) describe('#integration byte arrays', () => { - const originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL - - beforeAll(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000 - }) - - afterAll(() => { - jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout - }) - it('should support returning empty byte array if server supports byte arrays', done => { testValue(new Int8Array(0))(done) - }) + }, 60000) it('should support returning empty byte array if server supports byte arrays', done => { testValues([new Int8Array(0)])(done) - }) + }, 60000) it('should support returning short byte arrays if server supports byte arrays', done => { testValues(randomByteArrays(100, 1, 255))(done) - }) + }, 60000) it('should support returning medium byte arrays if server supports byte arrays', done => { testValues(randomByteArrays(50, 256, 65535))(done) - }) + }, 60000) it('should support returning long byte arrays if server supports byte arrays', done => { testValues(randomByteArrays(10, 65536, 2 * 65536))(done) - }) + }, 60000) it('should fail to return byte array if server does not support byte arrays', done => { const driver = neo4j.driver( @@ -232,7 +222,7 @@ describe('#integration byte arrays', () => { }) .then(() => driver.close()) .then(() => done()) - }) + }, 60000) }) function testValue (actual, expected) {