Merge pull request #187 from strongloop/fix-default-test-configs
Fix pretest and init test configs
This commit is contained in:
commit
4ce71a3489
22
pretest.js
22
pretest.js
|
@ -1,16 +1,20 @@
|
|||
'use strict';
|
||||
// TODO: used for testing support for parallel testing on ci.strongloop.com which
|
||||
// provides MYSQL_* env vars instead of TEST_MYSQL_* env vars.
|
||||
process.env.TEST_MYSQL_USER = process.env.TEST_MYSQL_USER || process.env.MYSQL_USER;
|
||||
process.env.TEST_MYSQL_PASSWORD = process.env.TEST_MYSQL_PASSWORD || process.env.MYSQL_PASSWORD;
|
||||
process.env.TEST_MYSQL_HOST = process.env.TEST_MYSQL_HOST || process.env.MYSQL_HOST;
|
||||
process.env.TEST_MYSQL_PORT = process.env.TEST_MYSQL_PORT || process.env.MYSQL_PORT;
|
||||
|
||||
if (!process.env.TEST_MYSQL_USER) {
|
||||
console.log('not seeding DB with example db');
|
||||
return;
|
||||
if (!process.env.TEST_MYSQL_USER &&
|
||||
!process.env.MYSQL_USER &&
|
||||
!process.env.CI) {
|
||||
return console.log('Not seeding DB with test db');
|
||||
}
|
||||
|
||||
process.env.TEST_MYSQL_HOST =
|
||||
process.env.TEST_MYSQL_HOST || process.env.MYSQL_HOST || 'localhost';
|
||||
process.env.TEST_MYSQL_PORT =
|
||||
process.env.TEST_MYSQL_PORT || process.env.MYSQL_PORT || 3306;
|
||||
process.env.TEST_MYSQL_USER =
|
||||
process.env.TEST_MYSQL_USER || process.env.MYSQL_USER || 'test';
|
||||
process.env.TEST_MYSQL_PASSWORD =
|
||||
process.env.TEST_MYSQL_PASSWORD || process.env.MYSQL_PASSWORD || 'test';
|
||||
|
||||
var fs = require('fs');
|
||||
var cp = require('child_process');
|
||||
|
||||
|
|
16
test/init.js
16
test/init.js
|
@ -4,12 +4,6 @@
|
|||
// License text available at https://opensource.org/licenses/MIT
|
||||
|
||||
'use strict';
|
||||
// TODO: used for testing support for parallel testing on ci.strongloop.com which
|
||||
// provides MYSQL_* env vars instead of TEST_MYSQL_* env vars.
|
||||
process.env.TEST_MYSQL_USER = process.env.TEST_MYSQL_USER || process.env.MYSQL_USER;
|
||||
process.env.TEST_MYSQL_PASSWORD = process.env.TEST_MYSQL_PASSWORD || process.env.MYSQL_PASSWORD;
|
||||
process.env.TEST_MYSQL_HOST = process.env.TEST_MYSQL_HOST || process.env.MYSQL_HOST;
|
||||
process.env.TEST_MYSQL_PORT = process.env.TEST_MYSQL_PORT || process.env.MYSQL_PORT;
|
||||
|
||||
module.exports = require('should');
|
||||
|
||||
|
@ -19,11 +13,13 @@ var config = require('rc')('loopback', {test: {mysql: {}}}).test.mysql;
|
|||
console.log(config);
|
||||
global.getConfig = function(options) {
|
||||
var dbConf = {
|
||||
host: process.env.TEST_MYSQL_HOST || config.host || 'localhost',
|
||||
port: process.env.TEST_MYSQL_PORT || config.port || 3306,
|
||||
host: process.env.TEST_MYSQL_HOST || process.env.MYSQL_HOST ||
|
||||
config.host || 'localhost',
|
||||
port: process.env.TEST_MYSQL_PORT || process.env.MYSQL_PORT ||
|
||||
config.port || 3306,
|
||||
database: 'myapp_test',
|
||||
username: process.env.TEST_MYSQL_USER || config.username,
|
||||
password: process.env.TEST_MYSQL_PASSWORD || config.password,
|
||||
username: process.env.MYSQL_USER || config.username,
|
||||
password: process.env.MYSQL_PASSWORD || config.password,
|
||||
createDatabase: true,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue