From 97a3b08642b0df65e5e97a890ff57209cfff8142 Mon Sep 17 00:00:00 2001 From: Oskar Hane Date: Mon, 25 May 2020 10:50:13 +0200 Subject: [PATCH] Fix sending tx metadata with each query Add E2E test to lock it in. --- e2e_tests/integration/bolt.spec.js | 10 ++++++++++ src/shared/services/bolt/transactions.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/e2e_tests/integration/bolt.spec.js b/e2e_tests/integration/bolt.spec.js index d3207771106..d36c2490996 100644 --- a/e2e_tests/integration/bolt.spec.js +++ b/e2e_tests/integration/bolt.spec.js @@ -54,6 +54,16 @@ describe('Bolt connections', () => { .and('contain', 'Database access not available') .should('not.contain', 'Connection lost') }) + if (Cypress.config('serverVersion') >= 3.5) { + it('send tx metadata with queries', () => { + cy.executeCommand(':clear') + const password = Cypress.config('password') + cy.connect('neo4j', password) + + cy.executeCommand(':queries') + cy.resultContains('"type": "user-action"') + }) + } if (isEnterpriseEdition()) { it('users with no role can connect and shows up in sidebar', () => { diff --git a/src/shared/services/bolt/transactions.js b/src/shared/services/bolt/transactions.js index 2e3faddb2b8..006546e93d5 100644 --- a/src/shared/services/bolt/transactions.js +++ b/src/shared/services/bolt/transactions.js @@ -56,7 +56,7 @@ function _trackedTransaction( const txFn = buildTxFunctionByMode(session) // Use same fn signature as session.run runFn = (input, parameters, metadata) => - txFn(tx => tx.run(input, parameters, metadata)) + txFn(tx => tx.run(input, parameters), metadata) } else { // Auto-Commit transaction, only used for PERIODIC COMMIT etc. runFn = session.run.bind(session) @@ -80,7 +80,7 @@ function _transaction(input, parameters, session, txMetadata = undefined) { const metadata = txMetadata ? { metadata: txMetadata } : undefined const txFn = buildTxFunctionByMode(session) - return txFn(tx => tx.run(input, parameters, metadata)) + return txFn(tx => tx.run(input, parameters), metadata) .then(r => { session.close() return r