Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support mysql-for-test #16

Merged
merged 4 commits into from
Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ sudo: required

services:
- docker
- mysql

language: node_js

Expand All @@ -15,4 +16,5 @@ before_install:
- docker run -d -p 12000:12000 jimexist/sqoop:1.99.7-2

script:
npm run coverage
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('1234') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
- npm run coverage
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
"prebuild": "npm run lint",
"build": "babel -d dist src",
"lint": "standard --verbose | snazzy",
"test": "mocha",
"test": "npm run pre-test-mysql && mocha",
"precommit": "npm run lint",
"prepush": "npm run lint",
"prepublish": "npm run clean && npm run build && npm run lint",
"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
"coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"pre-test-mysql": "mysql -uroot -p1234 < test/init.sql"
},
"dependencies": {
"isomorphic-fetch": "^2.2.1"
Expand Down
42 changes: 42 additions & 0 deletions test/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
drop database if exists harry;
create database harry;

use harry;

create table books (
id int not null AUTO_INCREMENT,
title varchar(100),
author varchar(100),
primary key (id)
);
insert into books (title, author) values ('the Sorcerer\'s Stone', 'J. K. Rowling');
insert into books (title, author) values ('the Chamber of Secrets', 'J. K. Rowling');
insert into books (title, author) values ('the Prisoner of Azkaban', 'J. K. Rowling');
insert into books (title, author) values ('the Goblet of Fire', 'J. K. Rowling');
insert into books (title, author) values ('the Order of the Phoenix', 'J. K. Rowling');
insert into books (title, author) values ('the Half-Blood Prince', 'J. K. Rowling');
insert into books (title, author) values ('the Deathly Hallows', 'J. K. Rowling');
insert into books (title, author) values ('the Cursed Child', 'J. K. Rowling');

create table characters (
id int not null AUTO_INCREMENT,
name varchar(100),
sex int,
primary key (id)
);
insert into characters (name, sex) values ('Albus Dumbledore', 1);
insert into characters (name, sex) values ('Severus Snape', 1);
insert into characters (name, sex) values ('James Potter', 1);
insert into characters (name, sex) values ('Lily Evans', 2);
insert into characters (name, sex) values ('Gellert Grindelwald', 1);
insert into characters (name, sex) values ('Dobby', 3);
insert into characters (name, sex) values ('Cho Chang', 2);
insert into characters (name, sex) values ('Hermione Jean Granger', 2);
insert into characters (name, sex) values ('Harry James Potter', 1);
insert into characters (name, sex) values ('Ronald Bilius Weasley(Ron)', 1);


show databases;
use harry;
select * from books;
select * from characters;