#1582 backed status check before e2e run
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-07-04 09:34:36 +02:00
parent fc80848506
commit 12f20b2d58
2 changed files with 30 additions and 3 deletions

View File

@ -1,3 +1,3 @@
export default { module.exports = {
url: 'http://localhost:5000' url: 'http://localhost:5000'
}; };

View File

@ -4,6 +4,8 @@ const exec = require('child_process').exec;
const PluginError = require('plugin-error'); const PluginError = require('plugin-error');
const argv = require('minimist')(process.argv.slice(2)); const argv = require('minimist')(process.argv.slice(2));
const log = require('fancy-log'); const log = require('fancy-log');
const request = require('request');
const e2eConfig = require('./e2e/helpers/config.js');
// Configuration // Configuration
@ -188,7 +190,31 @@ function e2eOnly() {
} }
e2eOnly.description = `Runs the e2e tests only`; e2eOnly.description = `Runs the e2e tests only`;
e2e = gulp.series(docker, e2eOnly); async function backendStatus() {
const milliseconds = 250;
return new Promise(resolve => {
let timer;
let attempts = 1;
timer = setInterval(() => {
const url = `${e2eConfig.url}/api/Applications/status`;
request.get(url, (err, res) => {
if (res.body == 'true') {
clearInterval(timer);
resolve(attempts);
} else
attempts++;
});
}, milliseconds);
});
}
backendStatus.description = `Performs a simple requests to check the backend status`;
e2e = gulp.series(docker, async function isBackendReady() {
const attempts = await backendStatus();
log(`Backend ready after ${attempts} attempt(s)`);
return attempts;
}, e2eOnly);
e2e.description = `Restarts database and runs the e2e tests`; e2e.description = `Restarts database and runs the e2e tests`;
function smokesOnly() { function smokesOnly() {
@ -533,5 +559,6 @@ module.exports = {
watch, watch,
docker, docker,
dockerStart, dockerStart,
dockerWait dockerWait,
backendStatus
}; };