-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FAB-1297 multichain tests for chaincode framework
https://jira.hyperledger.org/browse/FAB-1297 Adds tests to run system and user chaincodes on multiple chains Some points of interest . chains are initialized with the follow (use for "join") kvledger.CreateLedger(chainid) chaincode.DeploySysCCs(chainid) . kvledger.GetLedger panics if chain is not there . peer initializes with **TEST_CHAINID** . LCCC (and other system chaincodes) are initilized on each chain. So a user chaincode is registered with the LCCC for that chain Tests are serial but can be parallel when chaincode relaxes serialization Change-Id: Iae6c36d004d845cfe74f24e8fa9e8c47bac3b499 Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
- Loading branch information
Srinivasan Muralidharan
committed
Dec 8, 2016
1 parent
5c9fcc3
commit 42f2574
Showing
9 changed files
with
271 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright IBM Corp. 2016 All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package chaincode | ||
|
||
import ( | ||
"testing" | ||
|
||
pb "github.com/hyperledger/fabric/protos/peer" | ||
|
||
"golang.org/x/net/context" | ||
) | ||
|
||
func TestExecuteInvokeOnManyChains(t *testing.T) { | ||
chains := []string{"chain1", "chain2", "chain3", "chain4"} | ||
lis, err := initPeer(chains...) | ||
if err != nil { | ||
t.Fail() | ||
t.Logf("Error creating peer: %s", err) | ||
} | ||
|
||
defer finitPeer(lis, chains...) | ||
|
||
var ctxt = context.Background() | ||
|
||
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" | ||
chaincodeID := &pb.ChaincodeID{Name: "example02", Path: url} | ||
|
||
args := []string{"a", "b", "10"} | ||
for _, c := range chains { | ||
err = invokeExample02Transaction(ctxt, c, chaincodeID, args, true) | ||
if err != nil { | ||
t.Fail() | ||
t.Logf("Error invoking transaction: %s", err) | ||
} else { | ||
t.Logf("Invoke test passed for chain %s", c) | ||
} | ||
theChaincodeSupport.Stop(ctxt, c, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}}) | ||
} | ||
|
||
} |
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
Oops, something went wrong.