From 1c6583ae033d5dd3401f2f13c1979dba5e0ad8a6 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Thu, 30 Jan 2020 10:12:42 +0000 Subject: [PATCH] Set journal_mode to truncate for SQLite in tests no issue - we would regularly see IO errors coming from SQLite, which caused random regression tests to fail - the default journal_mode is `delete`, but this is slow and can cause issues when multiple tests try to remove the journal file - `truncate` is faster and shouldn't cause these issues --- core/test/utils/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/test/utils/index.js b/core/test/utils/index.js index b5a0dc2388..f5559749f6 100644 --- a/core/test/utils/index.js +++ b/core/test/utils/index.js @@ -931,6 +931,13 @@ startGhost = function startGhost(options) { settingsCache.reset(); return knexMigrator.init(); }) + .then(function setPragma() { + if (config.get('database:client') === 'sqlite3') { + return db.knex.raw('PRAGMA journal_mode = TRUNCATE;'); + } else { + return Promise.resolve(); + } + }) .then(function initializeGhost() { urlService.resetGenerators();