Skip to content

Commit

Permalink
[FAB-7010] NodeSDK - handle fabric-ca change
Browse files Browse the repository at this point in the history
Need to now register a a rigistar user with the
attributes it is allowed to register for users.
Update test case with new attribute for this.
Update a timing issue with timeout test that
intermittently failed.

Change-Id: Ib5de4832c511a9ebfab8cac7981e873fa1b03090
Signed-off-by: Bret Harrison <[email protected]>
  • Loading branch information
harrisob committed Nov 16, 2017
1 parent 1f03242 commit cfd6815
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions test/integration/fabric-ca-services-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ test('\n\n ** FabricCAServices: Test enroll() With Dynamic CSR **\n\n', function
affiliation: 'org1.department2',
attrs: [
{name: 'hf.Registrar.Roles', value: 'client'},
{name: 'hf.Registrar.Attributes', value: '*'},
{name:'dfattrib',value:'default', ecert:true},
{name:'myattrib',value:'somevalue and lots of other information'}
]}, member);
Expand Down
46 changes: 23 additions & 23 deletions test/integration/network-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ test('\n\n***** use the network configuration file *****\n\n', function(t) {
logger.debug(' response ::%j',result);
t.pass('Successfully created the channel.');
if(result.status && result.status === 'SUCCESS') {
return sleep(5000);
return sleep(10000);
} else {
t.fail('Failed to create the channel. ');
throw new Error('Failed to create the channel. ');
Expand Down Expand Up @@ -383,28 +383,6 @@ test('\n\n***** use the network configuration file *****\n\n', function(t) {
}).then((user)=> {
t.pass('Successfully enrolled user \'user1\' for org1');

let tx_id = client.newTransactionID(); // get a non admin transaction ID
var request = {
chaincodeId : 'example',
fcn: 'move',
args: ['a', 'b','100'],
txId: tx_id
//targets - Letting default to all endorsing peers defined on the channel in the network configuration
};

// put in a very small timeout to force a failure, thereby checking that the timeout value was being used
return channel.sendTransactionProposal(request, 1); //logged in as org1 user
}).then((results) => {
var proposalResponses = results[0];
for(var i in proposalResponses) {
let proposal_response = proposalResponses[i];
if( proposal_response instanceof Error && proposal_response.toString().indexOf('REQUEST_TIMEOUT') > 0) {
t.pass('Successfully cause a timeout error by setting the timeout setting to 1');
} else {
t.fail('Failed to get the timeout error');
}
}

// try again ...this time use a longer timeout
let tx_id = client.newTransactionID(); // get a non admin transaction ID
query_tx_id = tx_id.getTransactionID();
Expand Down Expand Up @@ -621,6 +599,28 @@ test('\n\n***** use the network configuration file *****\n\n', function(t) {
logger.debug(' queryTransaction ::%j',results);
t.equals(0, results.validationCode, 'Should be able to find our transaction validationCode by admin');

let tx_id = client.newTransactionID(); // get a non admin transaction ID
var request = {
chaincodeId : 'example',
fcn: 'move',
args: ['a', 'b','100'],
txId: tx_id
//targets - Letting default to all endorsing peers defined on the channel in the network configuration
};

// put in a very small timeout to force a failure, thereby checking that the timeout value was being used
return channel.sendTransactionProposal(request, 1); //logged in as org1 user
}).then((results) => {
var proposalResponses = results[0];
for(var i in proposalResponses) {
let proposal_response = proposalResponses[i];
if( proposal_response instanceof Error && proposal_response.toString().indexOf('REQUEST_TIMEOUT') > 0) {
t.pass('Successfully cause a timeout error by setting the timeout setting to 1');
} else {
t.fail('Failed to get the timeout error');
}
}

return true;
}).then((results) => {
t.pass('Testing has complete successfully');
Expand Down

0 comments on commit cfd6815

Please sign in to comment.