feat: refs #5483 Gulp and back tests adjustments
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Juan Ferrer 2024-01-15 12:35:23 +01:00
parent b7edbbe12f
commit 51a4608390
2 changed files with 30 additions and 19 deletions

View File

@ -1,6 +1,10 @@
const Docker = require('../db/docker.js'); const path = require('path');
const Myt = require('../../myt/myt');
const Run = require('../../myt/myt-run');
let dataSources = require('../loopback/server/datasources.json'); let dataSources = require('../loopback/server/datasources.json');
let myt;
process.on('warning', warning => { process.on('warning', warning => {
console.log(warning.name); console.log(warning.name);
console.log(warning.message); console.log(warning.message);
@ -8,28 +12,28 @@ process.on('warning', warning => {
}); });
process.on('SIGUSR2', async() => { process.on('SIGUSR2', async() => {
if (container) await container.rm(); if (myt) await myt.deinit();
}); });
process.on('exit', async function() { process.on('exit', async function() {
if (container) await container.rm(); if (myt) await myt.deinit();
}); });
let container;
async function test() { async function test() {
let isCI = false; const isCI = process.argv[2] === 'ci';
if (process.argv[2] === 'ci') myt = new Myt();
isCI = true; await myt.init({
workspace: path.join(__dirname, '..'),
random: true,
ci: isCI
});
const {dbConfig} = await myt.run(Run);
container = new Docker();
await container.run(isCI);
dataSources = JSON.parse(JSON.stringify(dataSources)); dataSources = JSON.parse(JSON.stringify(dataSources));
Object.assign(dataSources.vn, { Object.assign(dataSources.vn, {
host: container.dbConf.host, host: dbConfig.host,
port: container.dbConf.port port: dbConfig.port
}); });
const bootOptions = {dataSources}; const bootOptions = {dataSources};
@ -77,7 +81,7 @@ async function test() {
await jasmine.execute(); await jasmine.execute();
if (app) await app.disconnect(); if (app) await app.disconnect();
if (container) await container.rm(); if (myt) await myt.deinit();
console.log('App disconnected & container removed'); console.log('App disconnected & container removed');
} }

View File

@ -3,7 +3,9 @@ const gulp = require('gulp');
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 Docker = require('./db/docker.js'); const Myt = require('../myt/myt');
const Run = require('../myt/myt-run');
const Start = require('../myt/myt-start');
// Configuration // Configuration
@ -231,14 +233,18 @@ watch.description = `Watches for changes in routes and locale files`;
// Docker // Docker
async function dockerStart() { async function dockerStart() {
const container = new Docker('salix-db'); const myt = new Myt();
await container.start(); await myt.init({workspace: __dirname});
await myt.run(Start);
await myt.deinit();
} }
dockerStart.description = `Starts the salix-db container`; dockerStart.description = `Starts the salix-db container`;
async function docker() { async function docker() {
const container = new Docker('salix-db'); const myt = new Myt();
await container.run(); await myt.init({workspace: __dirname});
await myt.run(Run);
await myt.deinit();
} }
docker.description = `Runs the salix-db container`; docker.description = `Runs the salix-db container`;
@ -258,5 +264,6 @@ module.exports = {
locales, locales,
localesRoutes, localesRoutes,
watch, watch,
dockerStart,
docker docker
}; };