@@ -494,12 +494,12 @@ func TestInstallCCWithOpts(t *testing.T) {
494494 assert .Nil (t , err , "marshal should not have failed" )
495495
496496 // Setup targets
497- peer := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
497+ peer1 := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
498498 Status : http .StatusOK , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" , Payload : responseBytes }
499499
500500 // Already installed chaincode request
501501 req := InstallCCRequest {Name : "name" , Version : "version" , Path : "path" , Package : & api.CCPackage {Type : 1 , Code : []byte ("code" )}}
502- responses , err := rc .InstallCC (req , WithTargets (& peer ))
502+ responses , err := rc .InstallCC (req , WithTargets (& peer1 ))
503503 if err != nil {
504504 t .Fatal (err )
505505 }
@@ -512,18 +512,18 @@ func TestInstallCCWithOpts(t *testing.T) {
512512 t .Fatal ("Should have 'already installed' info set" )
513513 }
514514
515- if responses [0 ].Target != peer .MockURL {
516- t .Fatalf ("Expecting %s target URL, got %s" , peer .MockURL , responses [0 ].Target )
515+ if responses [0 ].Target != peer1 .MockURL {
516+ t .Fatalf ("Expecting %s target URL, got %s" , peer1 .MockURL , responses [0 ].Target )
517517 }
518518
519519 // Chaincode not found request (it will be installed)
520520 req = InstallCCRequest {Name : "ID" , Version : "v0" , Path : "path" , Package : & api.CCPackage {Type : 1 , Code : []byte ("code" )}}
521- responses , err = rc .InstallCC (req , WithTargets (& peer ))
521+ responses , err = rc .InstallCC (req , WithTargets (& peer1 ))
522522 if err != nil {
523523 t .Fatal (err )
524524 }
525525
526- if responses [0 ].Target != peer .MockURL {
526+ if responses [0 ].Target != peer1 .MockURL {
527527 t .Fatal ("Wrong target URL set" )
528528 }
529529
@@ -542,11 +542,11 @@ func TestInstallCCWithOpts(t *testing.T) {
542542 response .Chaincodes = chaincodes
543543 responseBytes , _ = proto .Marshal (response )
544544
545- peer = fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
545+ peer1 = fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
546546 Status : http .StatusOK , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" , Payload : responseBytes }
547547
548548 req = InstallCCRequest {Name : "error" , Version : "v0" , Path : "" , Package : & api.CCPackage {Type : 1 , Code : []byte ("code" )}}
549- _ , err = rc .InstallCC (req , WithTargets (& peer ))
549+ _ , err = rc .InstallCC (req , WithTargets (& peer1 ))
550550 if err == nil {
551551 t .Fatalf ("Should have failed since install cc returns an error in the client" )
552552 }
@@ -571,12 +571,12 @@ func TestInstallError(t *testing.T) {
571571func TestInstallCC (t * testing.T ) {
572572 rc := setupDefaultResMgmtClient (t )
573573
574- peer := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
574+ peer2 := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" ,
575575 Status : http .StatusOK , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" }
576576
577577 // Chaincode that is not installed already (it will be installed)
578578 req := InstallCCRequest {Name : "ID" , Version : "v0" , Path : "path" , Package : & api.CCPackage {Type : 1 , Code : []byte ("code" )}}
579- responses , err := rc .InstallCC (req , WithTargets (& peer ))
579+ responses , err := rc .InstallCC (req , WithTargets (& peer2 ))
580580 if err != nil {
581581 t .Fatal (err )
582582 }
@@ -701,8 +701,7 @@ func TestInstallCCWithOptsRequiredParameters(t *testing.T) {
701701
702702 // Setup targets
703703 var peers []fab.Peer
704- peer := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" }
705- peers = append (peers , & peer )
704+ peers = append (peers , & fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" })
706705
707706 // Test both targets and filter provided (error condition)
708707 _ , err = rc .InstallCC (req , WithTargets (peers ... ), WithTargetFilter (& mspFilter {mspID : "Org1MSP" }))
@@ -877,8 +876,7 @@ func TestInstantiateCCWithOptsRequiredParameters(t *testing.T) {
877876
878877 // Setup targets
879878 var peers []fab.Peer
880- peer := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" }
881- peers = append (peers , & peer )
879+ peers = append (peers , & fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" })
882880
883881 // Test both targets and filter provided (error condition)
884882 _ , err = rc .InstantiateCC ("mychannel" , req , WithTargets (peers ... ), WithTargetFilter (& mspFilter {mspID : "Org1MSP" }))
@@ -1083,8 +1081,7 @@ func TestUpgradeCCWithOptsRequiredParameters(t *testing.T) {
10831081
10841082 // Setup targets
10851083 var peers []fab.Peer
1086- peer := fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" }
1087- peers = append (peers , & peer )
1084+ peers = append (peers , & fcmocks.MockPeer {MockName : "Peer1" , MockURL : "http://peer1.com" , MockRoles : []string {}, MockCert : nil , MockMSP : "Org1MSP" })
10881085
10891086 // Test both targets and filter provided (error condition)
10901087 _ , err = rc .UpgradeCC ("mychannel" , req , WithTargets (peers ... ), WithTargetFilter (& mspFilter {mspID : "Org1MSP" }))
0 commit comments