From df18f25a703413ea67ad0a61cc676a97859c4c7d Mon Sep 17 00:00:00 2001 From: Antonio Barcelos Date: Thu, 30 Mar 2023 11:37:01 +0200 Subject: [PATCH] Fix integration test `CREATE USER` statement The statement was failing in newer database version since minimum password length changed to 8. Adjusting the password in the test fix the issue. The drop user routine was also fixed since it can hide information about the original failure. --- packages/neo4j-driver/test/rx/summary.test.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/neo4j-driver/test/rx/summary.test.js b/packages/neo4j-driver/test/rx/summary.test.js index 4baed3c45..2c961089e 100644 --- a/packages/neo4j-driver/test/rx/summary.test.js +++ b/packages/neo4j-driver/test/rx/summary.test.js @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import neo4j from '../../src' +import neo4j, { Neo4jError } from '../../src' // eslint-disable-next-line no-unused-vars import RxSession from '../../src/session-rx' // eslint-disable-next-line no-unused-vars @@ -344,15 +344,23 @@ describe('#integration-rx summary', () => { runnable = await session.beginTransaction().toPromise() } + let dropUser = true + try { await verifySystemUpdates( runnable, - "CREATE USER foo SET PASSWORD 'bar'", + "CREATE USER foo SET PASSWORD 'barizon1'", {}, 1 ) + } catch (e) { + // the user should not be dropped if their creation fails + dropUser = !(e instanceof Neo4jError) + throw e } finally { - await verifySystemUpdates(runnable, 'DROP USER foo', {}, 1) + if (dropUser) { + await verifySystemUpdates(runnable, 'DROP USER foo', {}, 1) + } } }