update Travis MySQL config
- pin mysql version to 5.7 - set necessary environment variables - create a test user & grant it priviledges to all schemas - change the name of the default schema Co-authored-by: Biniam Admikew <biniam@ca.ibm.com>
This commit is contained in:
parent
f809714241
commit
8d93eb38c7
18
.travis.yml
18
.travis.yml
|
@ -3,5 +3,19 @@ node_js:
|
|||
- "6"
|
||||
- "8"
|
||||
- "10"
|
||||
before_script:
|
||||
- "mysql -e 'create database myapp_test;'"
|
||||
# Xenial build environment comes with MySQL 5.7
|
||||
dist: xenial
|
||||
services:
|
||||
- mysql
|
||||
env:
|
||||
global:
|
||||
- MYSQL_HOST=localhost
|
||||
- MYSQL_PORT=3306
|
||||
- MYSQL_USER=test
|
||||
- MYSQL_PASSWORD=test
|
||||
before_install:
|
||||
- mysql -u root -e "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';"
|
||||
- mysql -e "use mysql; update user set authentication_string=PASSWORD('test') where User='test'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
|
||||
- mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
|
||||
- mysql -e "GRANT SUPER ON *.* TO 'test'@'localhost' IDENTIFIED BY 'test';FLUSH PRIVILEGES;"
|
||||
|
||||
|
|
30
pretest.js
30
pretest.js
|
@ -9,30 +9,30 @@ if (!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';
|
||||
process.env.MYSQL_HOST =
|
||||
process.env.MYSQL_HOST || process.env.MYSQL_HOST || 'localhost';
|
||||
process.env.MYSQL_PORT =
|
||||
process.env.MYSQL_PORT || process.env.MYSQL_PORT || 3306;
|
||||
process.env.MYSQL_USER =
|
||||
process.env.MYSQL_USER || process.env.MYSQL_USER || 'test';
|
||||
process.env.MYSQL_PASSWORD =
|
||||
process.env.MYSQL_PASSWORD || process.env.MYSQL_PASSWORD || 'test';
|
||||
|
||||
var fs = require('fs');
|
||||
var cp = require('child_process');
|
||||
|
||||
var sql = fs.createReadStream(require.resolve('./test/schema.sql'));
|
||||
var stdio = ['pipe', process.stdout, process.stderr];
|
||||
var args = ['--user=' + process.env.TEST_MYSQL_USER];
|
||||
var args = ['--user=' + process.env.MYSQL_USER];
|
||||
|
||||
if (process.env.TEST_MYSQL_HOST) {
|
||||
args.push('--host=' + process.env.TEST_MYSQL_HOST);
|
||||
if (process.env.MYSQL_HOST) {
|
||||
args.push('--host=' + process.env.MYSQL_HOST);
|
||||
}
|
||||
if (process.env.TEST_MYSQL_PORT) {
|
||||
args.push('--port=' + process.env.TEST_MYSQL_PORT);
|
||||
if (process.env.MYSQL_PORT) {
|
||||
args.push('--port=' + process.env.MYSQL_PORT);
|
||||
}
|
||||
if (process.env.TEST_MYSQL_PASSWORD) {
|
||||
args.push('--password=' + process.env.TEST_MYSQL_PASSWORD);
|
||||
if (process.env.MYSQL_PASSWORD) {
|
||||
args.push('--password=' + process.env.MYSQL_PASSWORD);
|
||||
}
|
||||
|
||||
console.log('seeding DB with example db...');
|
||||
|
|
Loading…
Reference in New Issue