Skip to content

Commit

Permalink
FAB-2016 Fix step logic in end-to-end.js
Browse files Browse the repository at this point in the history
When running end-to-end from a gulp task, i.e
'gulp test', there is a command line argument,
'test' which needs to be handled in the same way
as running from the command line with no arguments.
This change specifically looks for step1, step2
and step3.  Any other arguments will be treated
as no arguments.

Change-Id: I11e28fab17e5afe87680faeaabe436b5dc3229ff
Signed-off-by: cdaughtr <cdaughtr@us.ibm.com>
  • Loading branch information
cdaughtr committed Feb 2, 2017
1 parent 22ee9c8 commit 8ac3c44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gulp.task('test', ['pre-test'], function() {
'test/unit/endorser-tests.js',
'test/unit/orderer-tests.js',
'test/unit/orderer-chain-tests.js',
//'test/unit/end-to-end.js',
'test/unit/end-to-end.js',
'test/unit/headless-tests.js'
])
.pipe(tape({
Expand Down
16 changes: 10 additions & 6 deletions test/unit/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ if (process.argv.length > 2) {
steps.push(process.argv[i]);
}
}
logger.info('Found steps: %s', steps);
var useSteps = false;
if (steps.length > 0 &&
(steps.indexOf('step1') > -1 || steps.indexOf('step2') > -1 || steps.indexOf('step3') > -1))
useSteps = true;
logger.info('Found steps: %s', steps, 'useSteps: '+useSteps);

testUtil.setupChaincodeDeploy();

Expand Down Expand Up @@ -87,7 +91,7 @@ test('End-to-end flow of chaincode deploy, transaction invocation, and query', f
};
})(t, eh, t.end);

if (steps.length === 0 || steps.indexOf('step1') >= 0) {
if (!useSteps || steps.indexOf('step1') >= 0) {
logger.info('Executing step1');
promise = promise.then(
function(admin) {
Expand Down Expand Up @@ -167,7 +171,7 @@ test('End-to-end flow of chaincode deploy, transaction invocation, and query', f
t.pass('The chaincode deploy transaction has been successfully committed');
clearTimeout(handle);

if (steps.length === 0) {
if (!useSteps) {
// this is called without steps parameter in order to execute all steps
// in sequence, just continue
setTimeout(resolve, 2000);
Expand All @@ -190,7 +194,7 @@ test('End-to-end flow of chaincode deploy, transaction invocation, and query', f
);
}

if (steps.length === 0 || steps.indexOf('step2') >= 0) {
if (!useSteps || steps.indexOf('step2') >= 0) {
promise = promise.then(
function(data) {
logger.info('Executing step2');
Expand Down Expand Up @@ -276,7 +280,7 @@ test('End-to-end flow of chaincode deploy, transaction invocation, and query', f
t.pass('The chaincode deploy transaction has been successfully committed');
clearTimeout(handle);

if (steps.length === 0) {
if (!useSteps) {
// this is called without steps parameter in order to execute all steps
// in sequence, just continue
setTimeout(resolve, 2000);
Expand All @@ -298,7 +302,7 @@ test('End-to-end flow of chaincode deploy, transaction invocation, and query', f
);
}

if (steps.length === 0 || steps.indexOf('step3') >= 0) {
if (!useSteps || steps.indexOf('step3') >= 0) {
promise = promise.then(
function(data) {
logger.info('Executing step3');
Expand Down

0 comments on commit 8ac3c44

Please sign in to comment.