#841 Closed, bugs fixed, tests passed
This commit is contained in:
parent
2fbddfb586
commit
78d07a1e4f
54
gulpfile.js
54
gulpfile.js
|
@ -66,29 +66,21 @@ gulp.task('services-only', callback => {
|
||||||
* Runs the e2e tests, restoring the fixtures first.
|
* Runs the e2e tests, restoring the fixtures first.
|
||||||
*/
|
*/
|
||||||
gulp.task('e2e', ['docker'], async() => {
|
gulp.task('e2e', ['docker'], async() => {
|
||||||
await runSequenceP('e2e-only');
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the e2e tests.
|
|
||||||
*/
|
|
||||||
gulp.task('e2e-only', () => {
|
|
||||||
const jasmine = require('gulp-jasmine');
|
const jasmine = require('gulp-jasmine');
|
||||||
|
|
||||||
if (argv.show || argv.s)
|
if (argv.show || argv.s)
|
||||||
process.env.E2E_SHOW = true;
|
process.env.E2E_SHOW = true;
|
||||||
|
|
||||||
return gulp.src('./e2e_tests.js')
|
return gulp.src('./e2e/tests.js')
|
||||||
.pipe(jasmine({reporter: 'none'}));
|
.pipe(jasmine({reporter: 'none'}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the smokes tests, restoring the fixtures first.
|
||||||
|
*/
|
||||||
gulp.task('smokes', ['docker'], async() => {
|
gulp.task('smokes', ['docker'], async() => {
|
||||||
await runSequenceP('smokes-only');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('smokes-only', () => {
|
|
||||||
const jasmine = require('gulp-jasmine');
|
const jasmine = require('gulp-jasmine');
|
||||||
return gulp.src('./smokes-tests.js')
|
return gulp.src('./e2e/smokes-tests.js')
|
||||||
.pipe(jasmine({reporter: 'none'}));
|
.pipe(jasmine({reporter: 'none'}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -390,26 +382,21 @@ gulp.task('watch', function() {
|
||||||
// Docker
|
// Docker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuilds the docker, if already exists, destroys and
|
* Rebuilds the docker, if already exists, destroys and rebuild it.
|
||||||
* rebuild it.
|
* Also, if the container or it's image doesn't exists builds them.
|
||||||
*/
|
*/
|
||||||
gulp.task('docker', async() => {
|
gulp.task('docker', async() => {
|
||||||
try {
|
try {
|
||||||
await execP('docker rm -fv salix-db');
|
await execP('docker rm -fv salix-db');
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
try {
|
|
||||||
await execP('docker volume rm data');
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
log('Building image...');
|
await execP('docker build -t salix-db ./services/db');
|
||||||
await execP('docker build -t salix-db:latest ./services/db');
|
await execP('docker run -d --name salix-db -p 3306:3306 salix-db');
|
||||||
|
|
||||||
await runSequenceP('docker-run');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the minium effort to start the docker, if it doesn't exists calls
|
* Does the minium effort to start the docker, if it doesn't exists calls
|
||||||
* the 'docker-run' task, if it is started does nothing. Keep in mind that when
|
* the 'docker' task, if it is started does nothing. Keep in mind that when
|
||||||
* you do not rebuild the docker you may be using an outdated version of it.
|
* you do not rebuild the docker you may be using an outdated version of it.
|
||||||
* See the 'docker' task for more info.
|
* See the 'docker' task for more info.
|
||||||
*/
|
*/
|
||||||
|
@ -419,7 +406,7 @@ gulp.task('docker-start', async() => {
|
||||||
let result = await execP('docker container inspect -f "{{json .State}}" salix-db');
|
let result = await execP('docker container inspect -f "{{json .State}}" salix-db');
|
||||||
state = JSON.parse(result.stdout);
|
state = JSON.parse(result.stdout);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return await runSequenceP('docker-run');
|
return await runSequenceP('docker');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (state.Status) {
|
switch (state.Status) {
|
||||||
|
@ -434,28 +421,15 @@ gulp.task('docker-start', async() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the docker, if the container or it's image doesn't exists builds them.
|
|
||||||
*/
|
|
||||||
gulp.task('docker-run', async() => {
|
|
||||||
try {
|
|
||||||
await execP('docker image inspect -f "{{json .Id}}" salix-db');
|
|
||||||
await execP('docker run -d --name salix-db --volume ./dist/salix-db:/data -p 3306:3306 salix-db');
|
|
||||||
await runSequenceP('docker-wait');
|
|
||||||
} catch (err) {
|
|
||||||
await runSequenceP('docker');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits until MySQL docker is started and ready to serve connections.
|
* Waits until MySQL docker is started and ready to serve connections.
|
||||||
*/
|
*/
|
||||||
gulp.task('docker-wait', callback => {
|
gulp.task('docker-wait', callback => {
|
||||||
const mysql = require('mysql2');
|
const mysql = require('mysql2');
|
||||||
|
|
||||||
let interval = 1;
|
let interval = 100;
|
||||||
let elapsedTime = 0;
|
let elapsedTime = 0;
|
||||||
let maxInterval = 30 * 60;
|
let maxInterval = 30 * 60 * 1000;
|
||||||
|
|
||||||
log('Waiting for MySQL init process...');
|
log('Waiting for MySQL init process...');
|
||||||
checker();
|
checker();
|
||||||
|
@ -487,7 +461,7 @@ gulp.task('docker-wait', callback => {
|
||||||
if (elapsedTime >= maxInterval)
|
if (elapsedTime >= maxInterval)
|
||||||
callback(new Error(`MySQL not initialized whithin ${elapsedTime} secs`));
|
callback(new Error(`MySQL not initialized whithin ${elapsedTime} secs`));
|
||||||
else
|
else
|
||||||
setTimeout(checker, interval * 1000);
|
setTimeout(checker, interval);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue