Skip to content

Commit

Permalink
FABN-1378 NodeSDK Lifecycle timeout
Browse files Browse the repository at this point in the history
Increase the timing on interactions with the peer.

Signed-off-by: Bret Harrison <[email protected]>
Change-Id: I7aa753ca4db2129835cd987ceb64653e535ba6ac
  • Loading branch information
harrisob authored and Simon Stone committed Sep 26, 2019
1 parent 38daed6 commit 7ade43c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
9 changes: 5 additions & 4 deletions test/scenario/features/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ const os = require('os');

// High level constants for timeouts
const TIMEOUTS = {
LONG_STEP : 240 * 1000,
MED_STEP : 120 * 1000,
HUGE_TIME: 20 * 60 * 1000,
LONG_STEP: 240 * 1000,
MED_STEP: 120 * 1000,
SHORT_STEP: 60 * 1000,
LONG_INC : 30 * 1000,
MED_INC : 10 * 1000,
LONG_INC: 30 * 1000,
MED_INC: 10 * 1000,
SHORT_INC: 5 * 1000
};

Expand Down
24 changes: 13 additions & 11 deletions test/scenario/features/steps/chaincode_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Client = require('fabric-client');
module.exports = function () {

this.Then(/^I can package (.+?) chaincode at version (.+?) named (.+?) as organization (.+?) with goPath (.+?) located at (.+?) and metadata located at (.+?) with (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (chaincode_type, chaincode_version, chaincode_name, org_name, _go_path, _chaincode_path, metadata_path, init_required) => {
const cc_save_name = format('chaincode-%s-%s', org_name, chaincode_name);

Expand Down Expand Up @@ -45,14 +45,15 @@ module.exports = function () {

// ------------- test the package API
// const package_bytes = await chaincode.package(request);
testUtil.logMsg(` -- packaging step about to package ${chaincode_type} named ${chaincode_name}`);
await chaincode.package(request);

// save it for later use
Client.setConfigSetting(cc_save_name, {value: chaincode});
});

this.Then(/^I can install (.+?) chaincode at version (.+?) named (.+?) as organization (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.HUGE_TIME},
async (chaincode_type, chaincode_version, chaincode_name, org_name) => {
const cc_save_name = format('chaincode-%s-%s', org_name, chaincode_name);

Expand All @@ -62,7 +63,7 @@ module.exports = function () {

const request = {
target: peer,
request_timeout: 10000
request_timeout: 20 * 60 * 1000
};

// ------------- test the install API
Expand Down Expand Up @@ -119,7 +120,7 @@ module.exports = function () {
chaincode: chaincode,
targets: [peer],
txId: txId,
request_timeout: 3000
request_timeout: 60000
};

try {
Expand Down Expand Up @@ -153,7 +154,7 @@ module.exports = function () {
});

this.Then(/^I can commit (.+?) chaincode at version (.+?) named (.+?) as organization (.+?) on channel (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (chaincode_type, chaincode_version, chaincode_name, org_name, channel_name) => {
const step = 'Chaincode commit';
testUtil.logMsg(format('%s - starting for %s, %s, %s, %s, %s', step, chaincode_type, chaincode_version, chaincode_name, org_name, channel_name));
Expand All @@ -170,7 +171,7 @@ module.exports = function () {
chaincode: chaincode,
targets: [peer1, peer2],
txId: txId,
request_timeout: 3000
request_timeout: 60000
};

try {
Expand Down Expand Up @@ -234,6 +235,7 @@ module.exports = function () {
}

try {
// might be the first time, so will take extra time
const results = await channel.sendTransactionProposal(request, 120000);
if (results && results[0]) {
const proposalResponses = results[0];
Expand Down Expand Up @@ -267,7 +269,7 @@ module.exports = function () {
});

this.Then(/^I can query installed chaincode (.+?) as organization (.+?) on channel (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (chaincode_name, org_name, channel_name) => {
const step = 'QueryInstalledChaincode';
testUtil.logMsg(format('%s - starting for %s, %s, %s', step, chaincode_name, org_name, channel_name));
Expand Down Expand Up @@ -298,7 +300,7 @@ module.exports = function () {
});

this.Then(/^I can query installed chaincodes as organization (.+?) on channel (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (org_name, channel_name) => {
const step = 'QueryInstalledChaincodes';
testUtil.logMsg(format('%s - starting for %s, %s', step, org_name, channel_name));
Expand Down Expand Up @@ -326,7 +328,7 @@ module.exports = function () {
});

this.Then(/^I can query for defined chaincode (.+?) as organization (.+?) on channel (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (chaincode_name, org_name, channel_name) => {
const step = 'QueryChaincodeDefinition';
testUtil.logMsg(format('%s - starting for %s, %s, %s', step, chaincode_name, org_name, channel_name));
Expand Down Expand Up @@ -375,7 +377,7 @@ module.exports = function () {
if (result instanceof Error) {
testUtil.logAndThrow(result);
} else if (result) {
testUtil.logMsg(format('GetInstalledChaincodePackage - Good peer response %j', result));
testUtil.logMsg(format('GetInstalledChaincodePackage - Good peer response - too big to show'));
} else {
testUtil.logAndThrow('Problem with the GetInstalledChaincodePackage, no response returned');
}
Expand All @@ -385,7 +387,7 @@ module.exports = function () {
});

this.Then(/^I can query for chaincode (.+?) for commit status as organization (.+?) on channel (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
{timeout: testUtil.TIMEOUTS.LONG_STEP},
async (chaincode_name, org_name, channel_name) => {
const step = 'CheckCommitReadiness';
testUtil.logMsg(format('%s - starting for %s, %s, %s', step, chaincode_name, org_name, channel_name));
Expand Down

0 comments on commit 7ade43c

Please sign in to comment.