refactor
gitea/salix/pipeline/head This commit has test failures Details

This commit is contained in:
Javi Gallego 2020-06-29 14:26:27 +02:00
parent 87de2bd2fb
commit db06626675
5 changed files with 18 additions and 17 deletions

View File

@ -35,5 +35,5 @@ ENTRYPOINT ["docker-start.sh"]
CMD ["mysqld"] CMD ["mysqld"]
#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \ HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1 CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1

View File

@ -39,8 +39,7 @@ module.exports = class Docker {
let runChown = process.platform != 'linux'; let runChown = process.platform != 'linux';
const healthCheck = `--health-cmd='mysqladmin ping --silent'`; const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
const container = await this.execP(`docker run ${healthCheck} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
this.id = container.stdout; this.id = container.stdout;
try { try {
@ -54,7 +53,7 @@ module.exports = class Docker {
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort']; this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
} }
if (runChown) await this.wait(); await this.waitForHealthy();
} catch (err) { } catch (err) {
if (this.isRandom) if (this.isRandom)
await this.rm(); await this.rm();

View File

@ -122,9 +122,6 @@
"mysql": { "mysql": {
"columnName": "expenceFk" "columnName": "expenceFk"
} }
},
"compression": {
"type": "Number"
} }
}, },
"relations": { "relations": {

View File

@ -66,6 +66,11 @@ describe('sale updatePrice()', () => {
let saleUpdated = await app.models.Sale.findById(saleId); let saleUpdated = await app.models.Sale.findById(saleId);
createdSaleComponent = await app.models.SaleComponent.findOne({where: {saleFk: saleId, componentFk: manaComponentId}}); createdSaleComponent = await app.models.SaleComponent.findOne({where: {saleFk: saleId, componentFk: manaComponentId}});
console.log(manaComponentId);
console.log(saleId);
console.log(saleUpdated);
console.log(createdSaleComponent);
expect(saleUpdated.price).toBe(price); expect(saleUpdated.price).toBe(price);
expect(createdSaleComponent.value).toEqual(-2.04); expect(createdSaleComponent.value).toEqual(-2.04);
}); });

View File

@ -14,16 +14,16 @@ module.exports = Self => {
}); });
Self.getCurrentWorkerMana = async ctx => { Self.getCurrentWorkerMana = async ctx => {
let currentClientId = ctx.req.accessToken.userId; let userId = ctx.req.accessToken.userId;
let currentWorker = await Self.app.models.Worker.findOne({
where: {userFk: currentClientId}, console.log(userId);
fields: 'id' let workerMana = await Self.app.models.WorkerMana.findOne({
}); where: {workerFk: userId},
let currentWorkerMana = await Self.app.models.WorkerMana.findOne({
where: {workerFk: currentWorker.id},
fields: 'amount' fields: 'amount'
}); });
let workerMana1 = await Self.app.models.WorkerMana.find();
return currentWorkerMana ? currentWorkerMana.amount : 0; console.log(workerMana);
console.log(workerMana1);
return workerMana ? workerMana.amount : 0;
}; };
}; };