From 9fe70f84dc439db03d1604730703b71278547aea Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Wed, 2 Oct 2019 23:11:28 +0200 Subject: [PATCH] debug: test not destroying db in test-setup --- lib/db/index.js | 4 ++-- test/e2e/helpers/database-init.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/db/index.js b/lib/db/index.js index 94ceb67efe..a1abd45c08 100644 --- a/lib/db/index.js +++ b/lib/db/index.js @@ -9,9 +9,9 @@ const ClientMetricsDb = require('./client-metrics-db'); const ClientMetricsStore = require('./client-metrics-store'); const ClientApplicationsStore = require('./client-applications-store'); -module.exports.createStores = (config, eventBus) => { +module.exports.createStores = (config, eventBus, dbPool) => { const getLogger = config.getLogger; - const db = createDb(config); + const db = dbPool || createDb(config); const eventStore = new EventStore(db, getLogger); const clientMetricsDb = new ClientMetricsDb(db, getLogger); diff --git a/test/e2e/helpers/database-init.js b/test/e2e/helpers/database-init.js index cc356eb99f..5662829173 100644 --- a/test/e2e/helpers/database-init.js +++ b/test/e2e/helpers/database-init.js @@ -64,8 +64,8 @@ module.exports = async function init(databaseSchema = 'test', getLogger) { await db.raw(`CREATE SCHEMA IF NOT EXISTS ${options.databaseSchema}`); await migrator(options); - await db.destroy(); - const stores = await createStores(options, eventBus); + // await db.destroy(); + const stores = await createStores(options, eventBus, db); await resetDatabase(stores); await setupDatabase(stores);