Skip to content

Fix error check in the bolt-v3.test #947

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
Jun 14, 2022
Merged
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
28 changes: 21 additions & 7 deletions packages/neo4j-driver/test/bolt-v3.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('#integration Bolt V3 API', () => {
})

it('should set transaction metadata for auto-commit transaction', async () => {
if (!databaseSupportsBoltV3() || !databaseSupportsListTransaction()) {
if (!databaseSupportsBoltV3() || !(await databaseSupportsListTransaction())) {
return
}

Expand Down Expand Up @@ -93,7 +93,8 @@ describe('#integration Bolt V3 API', () => {
// ClientError on 4.1 and later
if (
e.code !== 'Neo.ClientError.Transaction.TransactionTimedOut' &&
e.code !== 'Neo.TransientError.Transaction.LockClientStopped'
e.code !== 'Neo.TransientError.Transaction.LockClientStopped' &&
e.code !== 'Neo.ClientError.Transaction.LockClientStopped'
) {
fail('Expected transaction timeout error but got: ' + e.code)
}
Expand Down Expand Up @@ -173,7 +174,7 @@ describe('#integration Bolt V3 API', () => {
)

it('should set transaction metadata for explicit transactions', async () => {
if (!databaseSupportsBoltV3() || !databaseSupportsListTransaction()) {
if (!databaseSupportsBoltV3() || !(await databaseSupportsListTransaction())) {
return
}

Expand Down Expand Up @@ -216,7 +217,8 @@ describe('#integration Bolt V3 API', () => {
// ClientError on 4.1 and later
if (
e.code !== 'Neo.ClientError.Transaction.TransactionTimedOut' &&
e.code !== 'Neo.TransientError.Transaction.LockClientStopped'
e.code !== 'Neo.TransientError.Transaction.LockClientStopped' &&
e.code !== 'Neo.ClientError.Transaction.LockClientStopped'
) {
fail('Expected transaction timeout error but got: ' + e.code)
}
Expand Down Expand Up @@ -448,7 +450,7 @@ describe('#integration Bolt V3 API', () => {
}, 20000)

async function testTransactionMetadataWithTransactionFunctions (read) {
if (!databaseSupportsBoltV3() || !databaseSupportsListTransaction()) {
if (!databaseSupportsBoltV3() || !(await databaseSupportsListTransaction())) {
return
}

Expand Down Expand Up @@ -552,7 +554,19 @@ describe('#integration Bolt V3 API', () => {
return protocolVersion >= 3
}

function databaseSupportsListTransaction () {
return sharedNeo4j.edition === 'enterprise'
async function databaseSupportsListTransaction () {
if (sharedNeo4j.edition === 'enterprise') {
try {
await session.run(
'CALL dbms.listTransactions()',
{}
)
return true
} catch (e) {
console.error('Database does not support dbms.listTransactions()', e)
return false
}
}
return false
}
})