Skip to content

Commit

Permalink
Add fv test chaincode deploy logging
Browse files Browse the repository at this point in the history
Previously if chaincode deploy failed during fvt tests no message was logged making it impossible to troubleshoot.
Now the chaincode deploy commands and results and logged.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
  • Loading branch information
denyeart authored and jt-nti committed Sep 29, 2022
1 parent 341956d commit 78a02ad
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/fv/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

const util = require('util');
const childProcess = require('child_process');
const execSync = require('child_process').execSync;
const exec = util.promisify(childProcess.exec);
const fs = require('fs');
const path = require('path');
const ip = require('ip');
const execSync = require('child_process').execSync;

const ordererCA = '/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem';
const dir = path.join(__dirname, '..', '..', 'fabric-samples');
Expand Down Expand Up @@ -43,7 +43,16 @@ async function install(ccName, transient) {
const CCDir = path.join(__dirname, '..', 'chaincodes', ccName);
const collectionConfig = transient ? `-cccg ${CCDir}/collection-config/collection.json` : '';
const cmd = `cd ${networkScriptDir} && ./network.sh deployCC -ccn ${ccName} -ccp ${CCDir} -ccl javascript ${collectionConfig} -ccep "OR('Org1MSP.peer','Org2MSP.peer')"`;
await exec(cmd);

const {error, stderr, stdout} = await exec(cmd);
if (error) {
console.log(`error: ${error.message}`);
}
if (stderr) {
console.log(`stderr: ${stderr}`);
}
console.log(`stdout: ${stdout}`);

} finally {
fs.unlinkSync(npmrc);
}
Expand Down

0 comments on commit 78a02ad

Please sign in to comment.