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"]
#HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
# CMD mysqladmin ping -h 127.0.0.1 -u root || exit 1
HEALTHCHECK --interval=5s --timeout=10s --retries=200 \
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';
const healthCheck = `--health-cmd='mysqladmin ping --silent'`;
const container = await this.execP(`docker run ${healthCheck} --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
this.id = container.stdout;
try {
@ -54,7 +53,7 @@ module.exports = class Docker {
this.dbConf.port = netSettings.Ports['3306/tcp'][0]['HostPort'];
}
if (runChown) await this.wait();
await this.waitForHealthy();
} catch (err) {
if (this.isRandom)
await this.rm();

View File

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

View File

@ -66,6 +66,11 @@ describe('sale updatePrice()', () => {
let saleUpdated = await app.models.Sale.findById(saleId);
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(createdSaleComponent.value).toEqual(-2.04);
});

View File

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