Skip to content

Commit 483619e

Browse files
committed
[FAB-1141] Added deployment to boostrap feature
Added concept of cert alias for developers working with a channel. Added new CLI command 'peer chaincode package' to support the ability to leverage the locally built peer to create deployment specs using chaincode specs. Now support caching of deployment specs with user config option cache-deployment-spec. For example: >behave -k -D cache-deployment-spec features/bootstrap.feature Added slugify function, requires pip install: >sudo pip install python-slugify. Regenerated peer/proposal_response proto and peer/chaincode proto. Updated endorsment process to use updated proto definitions. Changed to use of /var/sock and volume for CORE_VM_ENDPOINT setting in compose-defaults.yml. Changed from beta grpc usage in python to grpc. Set max message size on python grpc channel creation. Added ContextHelper for GUUID usage and future temp/cache storage. Generated peer/peer and peer/proposal protos. Deleted older generated python proto files. Changed logging of proposal payload to min of 128 or lenghth of payload for hex dump. Removed check for config item key of "MSP", as the key is the MSP id. Adding HashingAlgorithm configuration item and defaulted to SHAKE256. Change-Id: I885d3e163c44782b182bce73e5e169d351e206ad Signed-off-by: jeffgarratt <[email protected]>
1 parent 0c2dff7 commit 483619e

22 files changed

+1165
-525
lines changed

bddtests/compose-defaults.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ services:
66
image: hyperledger/fabric-peer
77
environment:
88
- CORE_PEER_ADDRESSAUTODETECT=true
9-
- CORE_VM_ENDPOINT=http://172.17.0.1:2375
10-
# TODO: This is currently required due to BUG in variant logic based upon log level.
9+
# - CORE_VM_ENDPOINT=http://172.17.0.1:2375
1110
- CORE_LOGGING_LEVEL=DEBUG
1211
- CORE_PEER_NETWORKID=${CORE_PEER_NETWORKID}
1312
volumes:
1413
- ./volumes/peer:/var/hyperledger/bddtests/volumes/peer
14+
- /var/run/docker.sock:/var/run/docker.sock
1515
# Script will wait until membersrvc is up (if it exists) before starting
1616
# $$GOPATH (double dollar) required to prevent docker-compose doing its own
1717
# substitution before the value gets to the container

bddtests/features/bootstrap.feature

+55-16
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ Feature: Bootstrap
8282
And the ordererBootstrapAdmin runs the channel template tool to create the orderer configuration template "template1" for application developers using orderer "orderer0"
8383
And the ordererBootstrapAdmin distributes orderer configuration template "template1" and chain creation policy name "chainCreatePolicy1"
8484

85-
And the following application developers are defined for peer organizations
86-
| Developer | ChainCreationPolicyName | Organization |
87-
| dev0Org0 | chainCreatePolicy1 | peerOrg0 |
85+
And the following application developers are defined for peer organizations and each saves their cert as alias
86+
| Developer | ChainCreationPolicyName | Organization | AliasSavedUnder |
87+
| dev0Org0 | chainCreatePolicy1 | peerOrg0 | dev0Org0App1 |
8888

8989
# Need Consortium MSP info and
9090
# need to add the ChannelWriters ConfigItem (using ChannelWriters ref name),
@@ -102,6 +102,7 @@ Feature: Bootstrap
102102
| peer2Signer | peer2 | peerOrg1 |
103103

104104
# TODO: grab the peer orgs from template1 and put into Murali's MSP info SCIs.
105+
# Entry point for creating a channel from existing templates
105106
And the user "dev0Org0" creates a signedConfigEnvelope "createChannelSignedConfigEnvelope1"
106107
| ChannelID | Template | Chain Creation Policy Name | Anchors |
107108
| com.acme.blockchain.jdoe.Channel1 | template1 | chainCreatePolicy1 | anchors1 |
@@ -125,25 +126,63 @@ Feature: Bootstrap
125126

126127
Then user "dev0Org0" should get a delivery "genesisBlockForMyNewChannel" from "orderer0" of "1" blocks with "1" messages within "1" seconds
127128

128-
When user "dev0Org0" request to join channel using genesis block "genesisBlockForMyNewChannel" on peer "peer0" with result "joinChannelResult"
129-
| Developer | ChainCreationPolicyName | Organization |
130-
| dev0Org0 | chainCreatePolicy1 | peerOrg0 |
129+
# This is entry point for joining an existing channel
130+
When user "dev0Org0" using cert alias "dev0Org0App1" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult"
131+
| Peer |
132+
| peer0 |
133+
| peer2 |
131134

132135

133-
Then user "dev0Org0" expects result code for "joinChannelResult" of "200"
136+
Then user "dev0Org0" expects result code for "joinChannelResult" of "200" from peers:
137+
| Peer |
138+
| peer0 |
139+
| peer2 |
134140

135-
# TODO: Add the channel name!!
136-
When user "binhn" creates a chaincode spec "cc_spec" of type "GOLANG" for chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with args
141+
# Entry point for invoking on an existing channel
142+
When user "dev0Org0" creates a chaincode spec "cc_spec" with name "example02" of type "GOLANG" for chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with args
137143
| funcName | arg1 | arg2 | arg3 | arg4 |
138144
| init | a | 100 | b | 200 |
139-
And user "binhn" creates a deployment spec "cc_deploy_spec" using chaincode spec "cc_spec" and devops on peer "vp0"
140-
And user "binhn" creates a deployment proposal "proposal1" using chaincode deployment spec "cc_deploy_spec"
141-
And user "binhn" sends proposal "proposal1" to endorsers with timeout of "20" seconds:
142-
| peer0 |
143-
And user "binhn" stores their last result as "proposal1Responses"
144-
Then user "binhn" expects proposal responses "proposal1Responses" with status "200" from endorsers:
145-
| peer0 |
146145

146+
#And user "binhn" creates a deployment spec "cc_deploy_spec" using chaincode spec "cc_spec" and devops on peer "vp0"
147+
#And user "binhn" creates a deployment proposal "proposal1" using chaincode deployment spec "cc_deploy_spec"
148+
149+
# Under the covers, create a deployment spec, etc.
150+
And user "dev0Org0" using cert alias "dev0Org0App1" creates a deployment proposal "proposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "cc_spec"
151+
152+
And user "dev0Org0" sends proposal "proposal1" to endorsers with timeout of "30" seconds with proposal responses "deploymentProposalResponses":
153+
| Endorser |
154+
| peer0 |
155+
| peer2 |
156+
157+
158+
Then user "dev0Org0" expects proposal responses "deploymentProposalResponses" with status "200" from endorsers:
159+
| Endorser |
160+
| peer0 |
161+
| peer2 |
162+
163+
And user "dev0Org0" expects proposal responses "deploymentProposalResponses" each have the same value from endorsers:
164+
| Endorser |
165+
| peer0 |
166+
| peer2 |
167+
168+
When user "dev0Org0" creates a transaction "deploymentTransaction1" from proposal responses "deploymentProposalResponses"
169+
170+
And the user "dev0Org0" broadcasts transaction "deploymentTransaction1" on channel "com.acme.blockchain.jdoe.Channel1" to orderer "orderer0"
171+
172+
# Sleep as the deliver takes a bit
173+
And I wait "2" seconds
174+
175+
When user "dev0Org0" connects to deliver function on orderer "orderer0"
176+
And user "dev0Org0" sends deliver a seek request on orderer "orderer0" with properties:
177+
| ChainId | Start | End |
178+
| com.acme.blockchain.jdoe.Channel1 | 1 | 1 |
179+
180+
Then user "dev0Org0" should get a delivery "deploymentTransaction11Block" from "orderer0" of "1" blocks with "1" messages within "1" seconds
181+
182+
# TODO: Add a peer query stanza here
183+
184+
185+
# TODO: Once events are working, consider listen event listener as well.
147186

148187
Examples: Orderer Options
149188
| ComposeFile | Waittime | PolicyType | ConsensusType |

0 commit comments

Comments
 (0)