mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed theme storage getting confused between tests
- When starting ghost for e2e tests we create a content folder in the os tmp dir - This means that the folder can change between suites as ghost is started and restarted - For the most part this is fine, but theme storage caches the path to config (which makes sense, it's not meant to change whilst Ghost is in-memory) - This is a quick-n-dirty fix that just makes it possible to update that path in the tests, so we know it's in sync - Ideally we'd not cache the path, use a function to fetch it etc, or fully reset the theme storage layer, but this is the fix I have working today and so it's going in to unblock things for now
This commit is contained in:
parent
dabf143cae
commit
3e7039c47d
3 changed files with 11 additions and 3 deletions
|
@ -148,5 +148,8 @@ module.exports = {
|
|||
let result = await getStorage().delete(themeName);
|
||||
list.del(themeName);
|
||||
return result;
|
||||
},
|
||||
updateStoragePath: function (storagePath) {
|
||||
getStorage().storagePath = storagePath;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,20 +25,23 @@ const redirectsUtils = require('./redirects');
|
|||
const configUtils = require('./configUtils');
|
||||
const mockManager = require('./e2e-framework-mock-manager');
|
||||
|
||||
const themeStorage = require('../../core/server/services/themes/storage');
|
||||
|
||||
const boot = require('../../core/boot');
|
||||
const TestAgent = require('./test-agent');
|
||||
const db = require('./db-utils');
|
||||
|
||||
const startGhost = async () => {
|
||||
/**
|
||||
* We never use the root content folder for testing!
|
||||
* We use a tmp folder.
|
||||
*/
|
||||
* We never use the root content folder for testing!
|
||||
* We use a tmp folder.
|
||||
*/
|
||||
const contentFolder = path.join(os.tmpdir(), uuid.v4(), 'ghost-test');
|
||||
await prepareContentFolder({contentFolder});
|
||||
|
||||
// NOTE: need to pass this config to the server instance
|
||||
configUtils.set('paths:contentPath', contentFolder);
|
||||
themeStorage.updateStoragePath(configUtils.config.getContentPath('themes'));
|
||||
|
||||
const defaults = {
|
||||
backend: true,
|
||||
|
|
|
@ -18,6 +18,7 @@ const urlService = require('../../core/server/services/url');
|
|||
const settingsService = require('../../core/server/services/settings');
|
||||
const routeSettingsService = require('../../core/server/services/route-settings');
|
||||
const themeService = require('../../core/server/services/themes');
|
||||
const themeStorage = require('../../core/server/services/themes/storage');
|
||||
const limits = require('../../core/server/services/limits');
|
||||
const customRedirectsService = require('../../core/server/services/redirects');
|
||||
|
||||
|
@ -69,6 +70,7 @@ const prepareContentFolder = (options) => {
|
|||
* We use a tmp folder.
|
||||
*/
|
||||
configUtils.set('paths:contentPath', contentFolderForTests);
|
||||
themeStorage.updateStoragePath(configUtils.config.getContentPath('themes'));
|
||||
|
||||
fs.ensureDirSync(contentFolderForTests);
|
||||
fs.ensureDirSync(path.join(contentFolderForTests, 'data'));
|
||||
|
|
Loading…
Add table
Reference in a new issue