Skip to content

Commit 824bf1a

Browse files
committed
Add databaseAdapter support for tests, REDACT databaseAdapter info when logging
1 parent 4aba66c commit 824bf1a

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

spec/helper.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ process.noDeprecation = true;
3535
const cache = require('../lib/cache').default;
3636
const defaults = require('../lib/defaults').default;
3737
const ParseServer = require('../lib/index').ParseServer;
38+
const loadAdapter = require('../lib/Adapters/AdapterLoader').loadAdapter;
3839
const path = require('path');
3940
const TestUtils = require('../lib/TestUtils');
4041
const GridFSBucketAdapter = require('../lib/Adapters/Files/GridFSBucketAdapter')
@@ -53,7 +54,10 @@ let databaseAdapter;
5354
let databaseURI;
5455
// need to bind for mocking mocha
5556

56-
if (process.env.PARSE_SERVER_TEST_DB === 'postgres') {
57+
if (process.env.PARSE_SERVER_DATABASE_ADAPTER) {
58+
databaseAdapter = JSON.parse(process.env.PARSE_SERVER_DATABASE_ADAPTER);
59+
databaseAdapter = loadAdapter(databaseAdapter);
60+
} else if (process.env.PARSE_SERVER_TEST_DB === 'postgres') {
5761
databaseURI = process.env.PARSE_SERVER_TEST_DATABASE_URI || postgresURI;
5862
databaseAdapter = new PostgresStorageAdapter({
5963
uri: databaseURI,
@@ -433,8 +437,8 @@ try {
433437
// Fetch test exclusion list
434438
testExclusionList = require('./testExclusionList.json');
435439
console.log(`Using test exclusion list with ${testExclusionList.length} entries`);
436-
} catch(error) {
437-
if(error.code !== 'MODULE_NOT_FOUND') {
440+
} catch (error) {
441+
if (error.code !== 'MODULE_NOT_FOUND') {
438442
throw error;
439443
}
440444
}
@@ -444,10 +448,8 @@ global.it_id = (id, func) => {
444448
if (testExclusionList.includes(id)) {
445449
return xit;
446450
} else {
447-
if(func === undefined)
448-
return it;
449-
else
450-
return func;
451+
if (func === undefined) return it;
452+
else return func;
451453
}
452454
};
453455

src/cli/utils/runner.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ function logStartupOptions(options) {
55
return;
66
}
77
// Keys that may include sensitive information that will be redacted in logs
8-
const keysToRedact = [
9-
'databaseURI',
10-
'masterKey',
11-
'maintenanceKey',
12-
'push',
13-
];
8+
const keysToRedact = ['databaseAdapter', 'databaseURI', 'masterKey', 'maintenanceKey', 'push'];
149
for (const key in options) {
1510
let value = options[key];
1611
if (keysToRedact.includes(key)) {

0 commit comments

Comments
 (0)