bootstrap.feature 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. #
  2. # Test Bootstrap function
  3. #
  4. # Tags that can be used and will affect test internals:
  5. # @doNotDecompose will NOT decompose the named compose_yaml after scenario ends. Useful for setting up environment and reviewing after scenario.
  6. #
  7. # @generateDocs will generate documentation for the scenario that can be used for both verification and comprehension.
  8. #
  9. @bootstrap
  10. Feature: Bootstrap
  11. As a blockchain entrepreneur
  12. I want to bootstrap a new blockchain network
  13. @doNotDecompose
  14. @generateDocs
  15. Scenario Outline: Bootstrap a development network with 4 peers (2 orgs) and 1 orderer (1 org), each having a single independent root of trust (No fabric-ca, just openssl)
  16. #creates 1 self-signed key/cert pair per orderer organization
  17. Given the orderer network has organizations:
  18. | Organization | Readers | Writers | Admins |
  19. | ordererOrg0 | member | member | admin |
  20. And user requests role of orderer admin by creating a key and csr for orderer and acquires signed certificate from organization:
  21. | User | Orderer | Organization |
  22. | orderer0Signer | orderer0 | ordererOrg0 |
  23. | orderer1Signer | orderer1 | ordererOrg0 |
  24. | orderer2Signer | orderer2 | ordererOrg0 |
  25. # Rolenames : MspPrincipal.proto
  26. And the peer network has organizations:
  27. | Organization | Readers | Writers | Admins |
  28. | peerOrg0 | member | member | admin |
  29. # | peerOrg1 | member | member | admin |
  30. # | peerOrg2 | member | member | admin |
  31. And a ordererBootstrapAdmin is identified and given access to all public certificates and orderer node info
  32. And the ordererBootstrapAdmin creates a cert alias "bootstrapCertAlias" for orderer network bootstrap purposes for organizations
  33. | Organization |
  34. | ordererOrg0 |
  35. And the ordererBootstrapAdmin generates a GUUID to identify the orderer system chain and refer to it by name as "OrdererSystemChainId"
  36. And the ordererBootstrapAdmin creates a consortium "consortium1" (network name) for peer orgs who wish to form a network:
  37. | Organization |
  38. | peerOrg0 |
  39. # | peerOrg1 |
  40. # | peerOrg2 |
  41. # Order info includes orderer admin/orderer information and address (host:port) from previous steps
  42. # Only the peer organizations can vary.
  43. And the ordererBootstrapAdmin using cert alias "bootstrapCertAlias" creates the genesis block "ordererGenesisBlock" for chain "OrdererSystemChainId" for network config policy "<PolicyType>" and consensus "<ConsensusType>" using consortiums:
  44. | Consortium |
  45. | consortium1 |
  46. And the orderer admins inspect and approve the genesis block for chain "OrdererSystemChainId"
  47. # to be used for setting the orderer genesis block path parameter in composition
  48. And the orderer admins use the genesis block for chain "OrdererSystemChainId" to configure orderers
  49. # We now have an orderer network with NO peers. Now need to configure and start the peer network
  50. # This can be currently automated through folder creation of the proper form and placing PEMs.
  51. And user requests role for peer by creating a key and csr for peer and acquires signed certificate from organization:
  52. | User | Peer | Organization |AliasSavedUnder|
  53. | peer0Signer | peer0 | peerOrg0 | |
  54. | peer1Signer | peer1 | peerOrg0 | |
  55. | peer2Signer | peer2 | peerOrg0 | |
  56. | peer3Signer | peer3 | peerOrg0 | |
  57. | peer0Admin | peer0 | peerOrg0 |peer-admin-cert|
  58. | peer1Admin | peer1 | peerOrg0 |peer-admin-cert|
  59. | peer2Admin | peer2 | peerOrg0 |peer-admin-cert|
  60. | peer3Admin | peer3 | peerOrg0 |peer-admin-cert|
  61. And we compose "<ComposeFile>"
  62. # Sleep as to allow system up time
  63. And I wait "<SystemUpWaitTime>" seconds
  64. And the following application developers are defined for peer organizations and each saves their cert as alias
  65. | Developer | Consortium | Organization | AliasSavedUnder |
  66. | dev0Org0 | consortium1 | peerOrg0 | dev0Org0App1 |
  67. | dev0Org1 | consortium1 | peerOrg0 | dev0Org1App1 |
  68. # Need Consortium MSP info and
  69. # need to add the ChannelWriters ConfigItem (using ChannelWriters ref name),
  70. # ChannelReaders ConfigItem (using ChannelReaders ref name)AnchorPeers ConfigItem
  71. # and the ChaincodeLifecyclePolicy Config Item
  72. # NOTE: Template1 will simply hold refs to peer orgs that can create in this channel at the moment
  73. And the user "dev0Org0" creates a peer template "template1" with chaincode deployment policy using consortium "consortium1" and peer organizations:
  74. | Organization |
  75. | peerOrg0 |
  76. # | peerOrg1 |
  77. And the user "dev0Org0" creates an peer anchor set "anchors1" for channel "com.acme.blockchain.jdoe.Channel1" for orgs:
  78. | User | Peer | Organization |
  79. | peer0Signer | peer0 | peerOrg0 |
  80. # | peer2Signer | peer2 | peerOrg0 |
  81. # TODO: grab the peer orgs from template1 and put into Murali's MSP info SCIs.
  82. # Entry point for creating a channel from existing templates
  83. And the user "dev0Org0" creates a ConfigUpdateEnvelope "createChannelConfigUpdate1"
  84. | ChannelID | Template | Consortium | Anchors |
  85. | com.acme.blockchain.jdoe.Channel1 | template1 | consortium1 | anchors1 |
  86. And the user "dev0Org0" collects signatures for ConfigUpdateEnvelope "createChannelConfigUpdate1" from developers:
  87. | Developer | Cert Alias |
  88. | dev0Org0 | dev0Org0App1 |
  89. | dev0Org1 | dev0Org1App1 |
  90. And the user "dev0Org0" creates a ConfigUpdate Tx "configUpdateTx1" using cert alias "dev0Org0App1" using signed ConfigUpdateEnvelope "createChannelConfigUpdate1"
  91. And the user "dev0Org0" using cert alias "dev0Org0App1" broadcasts ConfigUpdate Tx "configUpdateTx1" to orderer "<orderer0>" to create channel "com.acme.blockchain.jdoe.Channel1"
  92. # Sleep as the deliver takes a bit to have the first block ready
  93. And I wait "<BroadcastWaitTime>" seconds
  94. When user "dev0Org0" using cert alias "dev0Org0App1" connects to deliver function on orderer "<orderer0>"
  95. And user "dev0Org0" sends deliver a seek request on orderer "<orderer0>" with properties:
  96. | ChainId | Start | End |
  97. | com.acme.blockchain.jdoe.Channel1 | 0 | 0 |
  98. Then user "dev0Org0" should get a delivery "genesisBlockForMyNewChannel" from "<orderer0>" of "1" blocks with "1" messages within "1" seconds
  99. Given user "dev0Org0" gives "genesisBlockForMyNewChannel" to user "dev0Org1"
  100. Given user "dev0Org0" gives "genesisBlockForMyNewChannel" to user "peer0Admin"
  101. Given user "dev0Org0" gives "genesisBlockForMyNewChannel" to user "peer1Admin"
  102. # This is entry point for joining an existing channel
  103. When user "peer0Admin" using cert alias "peer-admin-cert" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult"
  104. | Peer |
  105. | peer0 |
  106. Then user "peer0Admin" expects result code for "joinChannelResult" of "200" from peers:
  107. | Peer |
  108. | peer0 |
  109. When user "peer1Admin" using cert alias "peer-admin-cert" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult"
  110. | Peer |
  111. | peer1 |
  112. Then user "peer1Admin" expects result code for "joinChannelResult" of "200" from peers:
  113. | Peer |
  114. | peer1 |
  115. Given user "dev0Org1" gives "genesisBlockForMyNewChannel" to user "peer2Admin"
  116. Given user "dev0Org1" gives "genesisBlockForMyNewChannel" to user "peer3Admin"
  117. When user "peer2Admin" using cert alias "peer-admin-cert" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult"
  118. | Peer |
  119. | peer2 |
  120. Then user "peer2Admin" expects result code for "joinChannelResult" of "200" from peers:
  121. | Peer |
  122. | peer2 |
  123. When user "peer3Admin" using cert alias "peer-admin-cert" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult"
  124. | Peer |
  125. | peer3 |
  126. Then user "peer3Admin" expects result code for "joinChannelResult" of "200" from peers:
  127. | Peer |
  128. | peer3 |
  129. # Entry point for invoking on an existing channel
  130. When user "peer0Admin" 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
  131. | funcName | arg1 | arg2 | arg3 | arg4 |
  132. | init | a | 100 | b | 200 |
  133. # Under the covers, create a deployment spec, etc.
  134. And user "peer0Admin" using cert alias "peer-admin-cert" creates a install proposal "installProposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "cc_spec"
  135. And user "peer0Admin" using cert alias "peer-admin-cert" sends proposal "installProposal1" to endorsers with timeout of "90" seconds with proposal responses "installProposalResponses":
  136. | Endorser |
  137. | peer0 |
  138. Then user "peer0Admin" expects proposal responses "installProposalResponses" with status "200" from endorsers:
  139. | Endorser |
  140. | peer0 |
  141. Given user "peer0Admin" gives "cc_spec" to user "peer2Admin"
  142. # Under the covers, create a deployment spec, etc.
  143. When user "peer2Admin" using cert alias "peer-admin-cert" creates a install proposal "installProposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "cc_spec"
  144. And user "peer2Admin" using cert alias "peer-admin-cert" sends proposal "installProposal1" to endorsers with timeout of "90" seconds with proposal responses "installProposalResponses":
  145. | Endorser |
  146. | peer2 |
  147. Then user "peer2Admin" expects proposal responses "installProposalResponses" with status "200" from endorsers:
  148. | Endorser |
  149. | peer2 |
  150. Given user "peer0Admin" gives "cc_spec" to user "dev0Org0"
  151. # Under the covers, create a deployment spec, etc.
  152. When user "dev0Org0" using cert alias "dev0Org0App1" creates a instantiate proposal "instantiateProposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "cc_spec"
  153. And user "dev0Org0" using cert alias "dev0Org0App1" sends proposal "instantiateProposal1" to endorsers with timeout of "90" seconds with proposal responses "instantiateProposalResponses":
  154. | Endorser |
  155. | peer0 |
  156. | peer2 |
  157. Then user "dev0Org0" expects proposal responses "instantiateProposalResponses" with status "200" from endorsers:
  158. | Endorser |
  159. | peer0 |
  160. | peer2 |
  161. And user "dev0Org0" expects proposal responses "instantiateProposalResponses" each have the same value from endorsers:
  162. | Endorser |
  163. | peer0 |
  164. | peer2 |
  165. When the user "dev0Org0" creates transaction "instantiateTx1" from proposal "instantiateProposal1" and proposal responses "instantiateProposalResponses" for channel "com.acme.blockchain.jdoe.Channel1"
  166. And the user "dev0Org0" broadcasts transaction "instantiateTx1" to orderer "<orderer1>" on channel "com.acme.blockchain.jdoe.Channel1"
  167. # Sleep as the deliver takes a bit to have the first block ready
  168. And I wait "2" seconds
  169. And user "dev0Org0" sends deliver a seek request on orderer "<orderer0>" with properties:
  170. | ChainId | Start | End |
  171. | com.acme.blockchain.jdoe.Channel1 | 1 | 1 |
  172. Then user "dev0Org0" should get a delivery "deliveredInstantiateTx1Block" from "<orderer0>" of "1" blocks with "1" messages within "1" seconds
  173. # Sleep as the deliver takes a bit to have the first block ready
  174. And I wait "1" seconds
  175. # Entry point for invoking on an existing channel
  176. When user "dev0Org0" creates a chaincode invocation spec "querySpec1" using spec "cc_spec" with input:
  177. | funcName | arg1 |
  178. | query | a |
  179. # Under the covers, create a deployment spec, etc.
  180. And user "dev0Org0" using cert alias "dev0Org0App1" creates a proposal "queryProposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "querySpec1"
  181. And user "dev0Org0" using cert alias "dev0Org0App1" sends proposal "queryProposal1" to endorsers with timeout of "30" seconds with proposal responses "queryProposal1Responses":
  182. | Endorser |
  183. | peer0 |
  184. | peer2 |
  185. Then user "dev0Org0" expects proposal responses "queryProposal1Responses" with status "200" from endorsers:
  186. | Endorser |
  187. | peer0 |
  188. | peer2 |
  189. And user "dev0Org0" expects proposal responses "queryProposal1Responses" each have the same value from endorsers:
  190. | Endorser |
  191. | peer0 |
  192. | peer2 |
  193. # Entry point for invoking on an existing channel
  194. When user "dev0Org0" creates a chaincode invocation spec "invocationSpec1" using spec "cc_spec" with input:
  195. | funcName | arg1 | arg2 | arg3 |
  196. | invoke | a | b | 10 |
  197. # Under the covers, create a deployment spec, etc.
  198. And user "dev0Org0" using cert alias "dev0Org0App1" creates a proposal "invokeProposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "invocationSpec1"
  199. And user "dev0Org0" using cert alias "dev0Org0App1" sends proposal "invokeProposal1" to endorsers with timeout of "30" seconds with proposal responses "invokeProposal1Responses":
  200. | Endorser |
  201. | peer0 |
  202. | peer2 |
  203. Then user "dev0Org0" expects proposal responses "invokeProposal1Responses" with status "200" from endorsers:
  204. | Endorser |
  205. | peer0 |
  206. | peer2 |
  207. And user "dev0Org0" expects proposal responses "invokeProposal1Responses" each have the same value from endorsers:
  208. | Endorser |
  209. | peer0 |
  210. | peer2 |
  211. When the user "dev0Org0" creates transaction "invokeTx1" from proposal "invokeProposal1" and proposal responses "invokeProposal1Responses" for channel "com.acme.blockchain.jdoe.Channel1"
  212. And the user "dev0Org0" broadcasts transaction "invokeTx1" to orderer "<orderer2>" on channel "com.acme.blockchain.jdoe.Channel1"
  213. # Sleep as the deliver takes a bit to have the first block ready
  214. And I wait "2" seconds
  215. And user "dev0Org0" sends deliver a seek request on orderer "<orderer0>" with properties:
  216. | ChainId | Start | End |
  217. | com.acme.blockchain.jdoe.Channel1 | 2 | 2 |
  218. Then user "dev0Org0" should get a delivery "deliveredInvokeTx1Block" from "<orderer0>" of "1" blocks with "1" messages within "1" seconds
  219. # TODO: Once events are working, consider listen event listener as well.
  220. Examples: Orderer Options
  221. | ComposeFile | SystemUpWaitTime | ConsensusType | BroadcastWaitTime | orderer0 | orderer1 | orderer2 |Orderer Specific Info|
  222. | docker-compose-next-4.yml | 0 | solo | 2 | orderer0 | orderer0 | orderer0 | |
  223. # | docker-compose-next-4.yml ./environments/orderer-1-kafka-1/docker-compose.yml orderer-3-kafka-1.yml | 5 | kafka | 5 | orderer0 | orderer1 | orderer2 | |
  224. # | docker-compose-next-4.yml docker-compose-next-4-couchdb.yml | 10 | solo | 2 | orderer0 | orderer0 | orderer0 | |
  225. # | docker-compose-next-4.yml docker-compose-next-4-couchdb.yml ./environments/orderer-1-kafka-1/docker-compose.yml orderer-3-kafka-1.yml | 10 | kafka | 5 | orderer0 | orderer1 | orderer2 | |
  226. # | docker-compose-next-4.yml ./environments/orderer-1-kafka-3/docker-compose.yml | 5 | kafka | 5 | orderer0 | orderer1 | orderer2 | |