Skip to content

fix Ipv6 Routing Table stub test #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/internal/node/routing.driver.boltkit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('#stub-routing routing driver with stub server', () => {
])
assertHasRouters(driver, [
'[ff02::1]:9001',
'[684d:1111:222:3333:4444:5555:6:77]:9002',
'[684D:1111:222:3333:4444:5555:6:77]:9002',
'[::1]:9003'
])

Expand All @@ -64,7 +64,7 @@ describe('#stub-routing routing driver with stub server', () => {
])
assertHasRouters(driver, [
'[ff02::1]:9001',
'[684d:1111:222:3333:4444:5555:6:77]:9002',
'[684D:1111:222:3333:4444:5555:6:77]:9002',
'[::1]:9003'
])

Expand Down Expand Up @@ -615,9 +615,9 @@ describe('#stub-routing routing driver with stub server', () => {
return connectionProvider._connectionPool
}

function getRoutingTable (driver, database) {
function getRoutingTable (driver, database = null) {
const connectionProvider = driver._getOrCreateConnectionProvider()
return connectionProvider._routingTableRegistry.get(database || '', {})
return connectionProvider._routingTableRegistry.get(database, {})
}

function numberOfOpenConnections (driver) {
Expand Down
60 changes: 31 additions & 29 deletions test/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,7 @@ const {

const { PROTOCOL_ERROR, SESSION_EXPIRED } = error

describe('#integration session', () => {
let driver
let session
// eslint-disable-next-line no-unused-vars
let protocolVersion

beforeEach(async () => {
driver = neo4j.driver(
`bolt://${sharedNeo4j.hostname}`,
sharedNeo4j.authToken
)
session = driver.session()

protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver)
})

afterEach(async () => {
await driver.close()
})

describe('#unit session', () => {
it('close should return promise', done => {
const connection = new FakeConnection()
const session = newSessionWithConnection(connection)
Expand Down Expand Up @@ -114,6 +95,27 @@ describe('#integration session', () => {
done()
})
}, 70000)
})

describe('#integration session', () => {
let driver
let session
// eslint-disable-next-line no-unused-vars
let protocolVersion

beforeEach(async () => {
driver = neo4j.driver(
`bolt://${sharedNeo4j.hostname}`,
sharedNeo4j.authToken
)
session = driver.session()

protocolVersion = await sharedNeo4j.cleanupAndGetProtocolVersion(driver)
})

afterEach(async () => {
await driver.close()
})

it('should be possible to close driver after closing session with failed tx ', done => {
const driver = neo4j.driver(
Expand Down Expand Up @@ -1194,15 +1196,6 @@ describe('#integration session', () => {
.then(() => callback())
}

function newSessionWithConnection (connection) {
const connectionProvider = new SingleConnectionProvider(
Promise.resolve(connection)
)
const session = new Session({ mode: READ, connectionProvider })
session.beginTransaction() // force session to acquire new connection
return session
}

function idleConnectionCount (driver) {
const connectionProvider = driver._connectionProvider
const address = connectionProvider._address
Expand Down Expand Up @@ -1311,3 +1304,12 @@ describe('#integration session', () => {
})
}
})

function newSessionWithConnection (connection) {
const connectionProvider = new SingleConnectionProvider(
Promise.resolve(connection)
)
const session = new Session({ mode: READ, connectionProvider })
session.beginTransaction() // force session to acquire new connection
return session
}