Skip to content

Commit

Permalink
FAB-952 end-to-end test fails in a clean environment
Browse files Browse the repository at this point in the history
reported by Eric Vaughn in slack. this is caused by end-to-end.js
using a different key value store but running after ca-tests.js
that has already enrolled the same user, causing the code to try
to re-enroll the same user with the CA, which gets rejected.

Change-Id: Ieaec5161b25866b6a333cc8cb3977f00523f910e
Signed-off-by: Jim Zhang <jzhang@us.ibm.com>
  • Loading branch information
jimthematrix committed Nov 3, 2016
1 parent 4498b18 commit cf80346
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
7 changes: 6 additions & 1 deletion build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ gulp.task('pre-test', function() {
});

gulp.task('test', ['pre-test'], function() {
return gulp.src('test/unit/*.js')
// use individual tests to control the sequence they get executed
// first run the ca-tests that tests all the member registration and
// enrollment scenarios (good and bad calls). then the rest of the
// tests will re-used the same key value store that has saved the
// user certificates so they can interact with the network
return gulp.src(['test/unit/ca-tests.js', 'test/unit/endorser-tests.js', 'test/unit/orderer-tests.js', 'test/unit/orderer-member-tests.js', 'test/unit/end-to-end.js', 'test/unit/headless-tests.js'])
.pipe(tape({
reporter: tapColorize()
}))
Expand Down
3 changes: 2 additions & 1 deletion test/unit/ca-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ var test = _test(tape);
var hfc = require('../..');
var util = require('util');
var fs = require('fs');
var testUtil = require('./util.js');

var keyValStorePath = '/tmp/keyValStore';
var keyValStorePath = testUtil.KVS;
var keyValStorePath2 = keyValStorePath + '2';

//
Expand Down
2 changes: 1 addition & 1 deletion test/unit/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var webUser;
testUtil.setupChaincodeDeploy();

chain.setKeyValueStore(hfc.newKeyValueStore({
path: '/tmp/kvs-hfc-e2e'
path: testUtil.KVS
}));

chain.setMemberServicesUrl('grpc://localhost:7054');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/endorser-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var util = require('util');
var fs = require('fs');
var testUtil = require('./util.js');

var keyValStorePath = '/tmp/keyValStore';
var keyValStorePath = testUtil.KVS;

testUtil.setupChaincodeDeploy();

Expand Down
3 changes: 2 additions & 1 deletion test/unit/orderer-member-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ var test = _test(tape);
var hfc = require('../..');
var util = require('util');
var fs = require('fs');
var testUtil = require('./util.js');

var Orderer = require('../../lib/Orderer.js');
var Member = require('../../lib/Member.js');

var keyValStorePath = '/tmp/keyValStore';
var keyValStorePath = testUtil.KVS;

//
// Orderer via chain setOrderer/getOrderer
Expand Down
3 changes: 2 additions & 1 deletion test/unit/orderer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ var test = _test(tape);
var hfc = require('../..');
var util = require('util');
var fs = require('fs');
var testUtil = require('./util.js');

var Orderer = require('../../lib/Orderer.js');

var keyValStorePath = '/tmp/keyValStore';
var keyValStorePath = testUtil.KVS;

//
// Orderer happy path test
Expand Down
1 change: 1 addition & 0 deletions test/unit/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var path = require('path');

module.exports.CHAINCODE_PATH = 'github.com/example_cc';
module.exports.KVS = '/tmp/hfc-test-kvs';

// temporarily set $GOPATH to the test fixture folder
module.exports.setupChaincodeDeploy = function() {
Expand Down

0 comments on commit cf80346

Please sign in to comment.