@@ -12,7 +12,6 @@ import (
12
12
"os"
13
13
"os/exec"
14
14
"path/filepath"
15
- "strings"
16
15
"syscall"
17
16
"time"
18
17
@@ -93,8 +92,7 @@ var _ = Describe("EndToEnd", func() {
93
92
Chaincode : world.Chaincode {
94
93
Name : "mycc" ,
95
94
Version : "1.0" ,
96
- Path : filepath .Join ("simple" , "cmd" ),
97
- GoPath : filepath .Join (testDir , "chaincode" ),
95
+ Path : "github.com/hyperledger/fabric/integration/chaincode/simple/cmd" ,
98
96
ExecPath : os .Getenv ("PATH" ),
99
97
},
100
98
InitArgs : `{"Args":["init","a","100","b","200"]}` ,
@@ -237,7 +235,6 @@ var _ = Describe("EndToEnd", func() {
237
235
w .BuildNetwork ()
238
236
239
237
By ("setting up the channel" )
240
- copyDir (filepath .Join ("testdata" , "chaincode" ), filepath .Join (testDir , "chaincode" ))
241
238
err := w .SetupChannel ()
242
239
Expect (err ).NotTo (HaveOccurred ())
243
240
@@ -252,34 +249,12 @@ var _ = Describe("EndToEnd", func() {
252
249
activations = CountValidationPluginActivations ()
253
250
Expect (activations ).To (Equal (peerCount ))
254
251
255
- By ("verifying the chaincode is installed" )
256
- adminPeer := components .Peer ()
257
- adminPeer .ConfigDir = filepath .Join (testDir , "org1.example.com_0" )
258
- adminPeer .MSPConfigPath = filepath .Join (testDir , "crypto" , "peerOrganizations" , "org1.example.com" , "users" , "Admin@org1.example.com" , "msp" )
259
- adminRunner := adminPeer .ChaincodeListInstalled ()
260
- execute (adminRunner )
261
- Eventually (adminRunner .Buffer ()).Should (gbytes .Say ("Path: simple/cmd" ))
262
-
263
- By ("waiting for the chaincode to complete instantiation" )
264
- listInstantiated := func () bool {
265
- p := components .Peer ()
266
- p .ConfigDir = filepath .Join (testDir , "org1.example.com_0" )
267
- p .MSPConfigPath = filepath .Join (testDir , "crypto" , "peerOrganizations" , "org1.example.com" , "users" , "Admin@org1.example.com" , "msp" )
268
- adminRunner := p .ChaincodeListInstantiated (w .Deployment .Channel )
269
- err := execute (adminRunner )
270
- if err != nil {
271
- return false
272
- }
273
- return strings .Contains (string (adminRunner .Buffer ().Contents ()), "Path: simple/cmd" )
274
- }
275
- Eventually (listInstantiated , 30 * time .Second , 500 * time .Millisecond ).Should (BeTrue ())
276
-
277
252
By ("querying the chaincode" )
278
- adminPeer = components .Peer ()
253
+ adminPeer : = components .Peer ()
279
254
adminPeer .LogLevel = "debug"
280
255
adminPeer .ConfigDir = filepath .Join (testDir , "org1.example.com_0" )
281
256
adminPeer .MSPConfigPath = filepath .Join (testDir , "crypto" , "peerOrganizations" , "org1.example.com" , "users" , "Admin@org1.example.com" , "msp" )
282
- adminRunner = adminPeer .QueryChaincode (w .Deployment .Chaincode .Name , w .Deployment .Channel , `{"Args":["query","a"]}` )
257
+ adminRunner : = adminPeer .QueryChaincode (w .Deployment .Chaincode .Name , w .Deployment .Channel , `{"Args":["query","a"]}` )
283
258
execute (adminRunner )
284
259
Eventually (adminRunner .Buffer ()).Should (gbytes .Say ("100" ))
285
260
@@ -310,21 +285,6 @@ func copyFile(src, dest string) {
310
285
Expect (err ).NotTo (HaveOccurred ())
311
286
}
312
287
313
- func copyDir (src , dest string ) {
314
- os .MkdirAll (dest , 0755 )
315
- objects , err := ioutil .ReadDir (src )
316
- for _ , obj := range objects {
317
- srcfileptr := src + "/" + obj .Name ()
318
- destfileptr := dest + "/" + obj .Name ()
319
- if obj .IsDir () {
320
- copyDir (srcfileptr , destfileptr )
321
- } else {
322
- copyFile (srcfileptr , destfileptr )
323
- }
324
- }
325
- Expect (err ).NotTo (HaveOccurred ())
326
- }
327
-
328
288
func execute (r ifrit.Runner ) (err error ) {
329
289
p := ifrit .Invoke (r )
330
290
Eventually (p .Ready ()).Should (BeClosed ())
0 commit comments