-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FABN-1348 NodeSDK allow targets with discovery
Allow the targets parameter to override the discovery plan. Signed-off-by: Bret Harrison <[email protected]> Change-Id: Iaba2989a6888cdfe03da436dde4fbe0dbd042f4c
- Loading branch information
Showing
7 changed files
with
105 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -985,6 +985,48 @@ test('\n\n***** Network End-to-end flow: specify endorsing peers *****\n\n', asy | |
t.end(); | ||
}); | ||
|
||
test('\n\n***** Network End-to-end flow: specify endorsing peers when discovery is enabled *****\n\n', async (t: any) => { | ||
const gateway = new Gateway(); | ||
try { | ||
const gatewayOptions = { | ||
clientTlsIdentity: 'tlsId', | ||
discovery: { | ||
asLocalhost: false, // leave false so that if use a discovered peer is used it will fail | ||
enabled: true, | ||
}, | ||
identity: '[email protected]', | ||
wallet: inMemoryWallet, | ||
}; | ||
|
||
await gateway.connect(JSON.parse(ccp.toString()), gatewayOptions); | ||
t.pass('Connected to the gateway'); | ||
|
||
const network = await gateway.getNetwork(channelName); | ||
t.pass('Initialized the network, ' + channelName); | ||
|
||
const contract = network.getContract(chaincodeId); | ||
t.pass('Got the contract'); | ||
|
||
// these peers will not have the same names as the discovered peers or | ||
// the same URL because asLocalhost is false | ||
const channel = network.getChannel(); | ||
const endorsingPeer1 = channel.getChannelPeer('peer0.org1.example.com'); | ||
const endorsingPeer2 = channel.getChannelPeer('peer0.org2.example.com'); | ||
|
||
await contract.createTransaction('echo') | ||
.setEndorsingPeers([endorsingPeer1, endorsingPeer2]) | ||
.submit('RESULT'); | ||
t.pass('Transaction was successfully submitted with endorsing peers'); | ||
} catch (error) { | ||
const stacktrace = error.stack; | ||
t.fail('Transaction failed with unexpected error: ' + stacktrace || error); | ||
} finally { | ||
gateway.disconnect(); | ||
} | ||
|
||
t.end(); | ||
}); | ||
|
||
test('\n\n***** Network End-to-end flow: invoke transaction to move money using in memory wallet and no event strategy *****\n\n', async (t: any) => { | ||
const gateway = new Gateway(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters