本文整理汇总了Golang中github.com/hyperledger/fabric/core/util.GetTestChainID函数的典型用法代码示例。如果您正苦于以下问题:Golang GetTestChainID函数的具体用法?Golang GetTestChainID怎么用?Golang GetTestChainID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTestChainID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ConstructTransaction
// ConstructTransaction constructs a transaction for testing
func ConstructTransaction(t *testing.T, simulationResults []byte, sign bool) (*common.Envelope, string, error) {
ccName := "foo"
txID := util.GenerateUUID()
var txEnv *common.Envelope
var err error
if sign {
txEnv, err = ptestutils.ConstructSingedTxEnvWithDefaultSigner(txID, util.GetTestChainID(), ccName, simulationResults, nil, nil)
} else {
txEnv, err = ptestutils.ConstructUnsingedTxEnv(txID, util.GetTestChainID(), ccName, simulationResults, nil, nil)
}
return txEnv, txID, err
}
开发者ID:hyperledger,项目名称:fabric,代码行数:13,代码来源:test_helper.go
示例2: TestExecuteInvokeTransaction
func TestExecuteInvokeTransaction(t *testing.T) {
chainID := util.GetTestChainID()
lis, err := initPeer(chainID)
if err != nil {
t.Fail()
t.Logf("Error creating peer: %s", err)
}
defer finitPeer(lis, chainID)
var ctxt = context.Background()
cccid := NewCCContext(chainID, "example02", "", "", false, nil)
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
chaincodeID := &pb.ChaincodeID{Name: "example02", Path: url}
args := []string{"a", "b", "10"}
err = invokeExample02Transaction(ctxt, cccid, chaincodeID, args, true)
if err != nil {
t.Fail()
t.Logf("Error invoking transaction: %s", err)
} else {
fmt.Printf("Invoke test passed\n")
t.Logf("Invoke test passed")
}
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:29,代码来源:exectransaction_test.go
示例3: TestRedeploy
//TestRedeploy - deploy two times, second time should fail but example02 should remain deployed
func TestRedeploy(t *testing.T) {
chainID := util.GetTestChainID()
//invalid arguments
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: "ex02", Path: "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"}, CtorMsg: &pb.ChaincodeInput{Args: [][]byte{[]byte("init"), []byte("a"), []byte("100"), []byte("b"), []byte("200")}}}
cccid := chaincode.NewCCContext(chainID, "ex02", "", "", false, nil)
_, _, err := deploy(endorserServer, chainID, spec, nil)
if err != nil {
t.Fail()
t.Logf("error in endorserServer.ProcessProposal %s", err)
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
//second time should not fail as we are just simulating
_, _, err = deploy(endorserServer, chainID, spec, nil)
if err != nil {
t.Fail()
t.Logf("error in endorserServer.ProcessProposal %s", err)
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:27,代码来源:endorser_test.go
示例4: TestGetMSPManagerFromBlock
func TestGetMSPManagerFromBlock(t *testing.T) {
conf, err := msp.GetLocalMspConfig("../../../msp/sampleconfig/")
if err != nil {
t.Fatalf("GetLocalMspConfig failed, err %s", err)
}
block, err := msptestutils.GetTestBlockFromMspConfig(conf)
if err != nil {
t.Fatalf("getTestBlockFromMspConfig failed, err %s", err)
}
mgr, err := GetMSPManagerFromBlock(block)
if err != nil {
t.Fatalf("GetMSPManagerFromBlock failed, err %s", err)
} else if mgr == nil {
t.Fatalf("Returned nil manager")
}
msps, err := mgr.GetMSPs()
if err != nil {
t.Fatalf("EnlistedMSPs failed, err %s", err)
}
if msps == nil || len(msps) == 0 {
t.Fatalf("There are no MSPS in the manager for chain %s", util.GetTestChainID())
}
}
开发者ID:hyperledger,项目名称:fabric,代码行数:27,代码来源:peermsp_test.go
示例5: TestGopathExecuteDeployTransaction
// Test deploy of a transaction with a GOPATH with multiple elements
func TestGopathExecuteDeployTransaction(t *testing.T) {
chainID := util.GetTestChainID()
// add a trailing slash to GOPATH
// and a couple of elements - it doesn't matter what they are
os.Setenv("GOPATH", os.Getenv("GOPATH")+string(os.PathSeparator)+string(os.PathListSeparator)+"/tmp/foo"+string(os.PathListSeparator)+"/tmp/bar")
executeDeployTransaction(t, chainID, "example01", "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01")
}
开发者ID:hyperledger,项目名称:fabric,代码行数:9,代码来源:exectransaction_test.go
示例6: TestHTTPExecuteDeployTransaction
// Test deploy of a transaction with a chaincode over HTTP.
func TestHTTPExecuteDeployTransaction(t *testing.T) {
chainID := util.GetTestChainID()
// The chaincode used here cannot be from the fabric repo
// itself or it won't be downloaded because it will be found
// in GOPATH, which would defeat the test
executeDeployTransaction(t, chainID, "example01", "http://gopkg.in/mastersingh24/fabric-test-resources.v1")
}
开发者ID:hyperledger,项目名称:fabric,代码行数:9,代码来源:exectransaction_test.go
示例7: getProposal
func getProposal() (*peer.Proposal, error) {
cis := &peer.ChaincodeInvocationSpec{
ChaincodeSpec: &peer.ChaincodeSpec{
ChaincodeID: &peer.ChaincodeID{Name: "foo"},
Type: peer.ChaincodeSpec_GOLANG}}
uuid := util.GenerateUUID()
return utils.CreateProposalFromCIS(uuid, util.GetTestChainID(), cis, signerSerialized)
}
开发者ID:hyperledger,项目名称:fabric,代码行数:10,代码来源:fullflow_test.go
示例8: TestFakeSetup
// TODO: as soon as proper per-chain MSP support is developed, this test will no longer be required
func TestFakeSetup(t *testing.T) {
err := LoadFakeSetupWithLocalMspAndTestChainMsp("../../../msp/sampleconfig/")
if err != nil {
t.Fatalf("LoadLocalMsp failed, err %s", err)
}
_, err = GetLocalMSP().GetDefaultSigningIdentity()
if err != nil {
t.Fatalf("GetDefaultSigningIdentity failed, err %s", err)
}
msps, err := GetManagerForChain(util.GetTestChainID()).GetMSPs()
if err != nil {
t.Fatalf("EnlistedMSPs failed, err %s", err)
}
if msps == nil || len(msps) == 0 {
t.Fatalf("There are no MSPS in the manager for chain %s", util.GetTestChainID())
}
}
开发者ID:hyperledger,项目名称:fabric,代码行数:21,代码来源:peermsp_test.go
示例9: TestDeployAndUpgrade
// TestUpgradeAndInvoke deploys chaincode_example01, upgrade it with chaincode_example02, then invoke it
func TestDeployAndUpgrade(t *testing.T) {
chainID := util.GetTestChainID()
var ctxt = context.Background()
url1 := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01"
url2 := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
chaincodeID1 := &pb.ChaincodeID{Path: url1, Name: "upgradeex01"}
chaincodeID2 := &pb.ChaincodeID{Path: url2, Name: "upgradeex01"}
f := "init"
argsDeploy := util.ToChaincodeArgs(f, "a", "100", "b", "200")
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: chaincodeID1, CtorMsg: &pb.ChaincodeInput{Args: argsDeploy}}
cccid1 := chaincode.NewCCContext(chainID, "upgradeex01", "", "", false, nil)
cccid2 := chaincode.NewCCContext(chainID, "upgradeex02", "", "", false, nil)
resp, prop, err := deploy(endorserServer, chainID, spec, nil)
chaincodeName := spec.ChaincodeID.Name
if err != nil {
t.Fail()
chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID1}})
chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID2}})
t.Logf("Error deploying <%s>: %s", chaincodeName, err)
return
}
err = endorserServer.(*Endorser).commitTxSimulation(prop, chainID, signer, resp)
if err != nil {
t.Fail()
chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID1}})
chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID2}})
t.Logf("Error committing <%s>: %s", chaincodeName, err)
return
}
argsUpgrade := util.ToChaincodeArgs(f, "a", "150", "b", "300")
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: chaincodeID2, CtorMsg: &pb.ChaincodeInput{Args: argsUpgrade}}
resp, prop, err = upgrade(endorserServer, chainID, spec, nil)
if err != nil {
t.Fail()
chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID1}})
chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID2}})
t.Logf("Error upgrading <%s>: %s", chaincodeName, err)
return
}
fmt.Printf("Upgrade test passed\n")
t.Logf("Upgrade test passed")
chaincode.GetChain().Stop(ctxt, cccid1, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID1}})
chaincode.GetChain().Stop(ctxt, cccid2, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID2}})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:54,代码来源:endorser_test.go
示例10: TestRangeQuery
// Test the invocation of a transaction.
func TestRangeQuery(t *testing.T) {
//TODO enable after ledger enables RangeQuery
t.Skip()
chainID := util.GetTestChainID()
lis, err := initPeer(chainID)
if err != nil {
t.Fail()
t.Logf("Error creating peer: %s", err)
}
defer finitPeer(lis, chainID)
var ctxt = context.Background()
url := "github.com/hyperledger/fabric/examples/chaincode/go/map"
cID := &pb.ChaincodeID{Name: "tmap", Path: url}
f := "init"
args := util.ToChaincodeArgs(f)
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
cccid := NewCCContext(chainID, "tmap", "", "", false, nil)
_, err = deploy(ctxt, cccid, spec)
chaincodeID := spec.ChaincodeID.Name
if err != nil {
t.Fail()
t.Logf("Error initializing chaincode %s(%s)", chaincodeID, err)
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
// Invoke second chaincode, which will inturn invoke the first chaincode
f = "keys"
args = util.ToChaincodeArgs(f)
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
_, _, _, err = invoke(ctxt, chainID, spec)
if err != nil {
t.Fail()
t.Logf("Error invoking <%s>: %s", chaincodeID, err)
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:51,代码来源:exectransaction_test.go
示例11: createProposalForChaincode
// createChaincodeDeploymentSpec Returns a deployment proposal of chaincode type
func createProposalForChaincode(ccChaincodeDeploymentSpec *pb.ChaincodeDeploymentSpec, creator []byte) (proposal *pb.Proposal, err error) {
var ccDeploymentSpecBytes []byte
if ccDeploymentSpecBytes, err = proto.Marshal(ccChaincodeDeploymentSpec); err != nil {
return nil, fmt.Errorf("Error creating proposal from ChaincodeDeploymentSpec: %s", err)
}
lcChaincodeSpec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG,
ChaincodeID: &pb.ChaincodeID{Name: "lccc"},
CtorMsg: &pb.ChaincodeInput{Args: [][]byte{[]byte("deploy"), []byte("default"), ccDeploymentSpecBytes}}}
lcChaincodeInvocationSpec := &pb.ChaincodeInvocationSpec{ChaincodeSpec: lcChaincodeSpec}
uuid := createProposalID()
// make proposal
return putils.CreateChaincodeProposal(uuid, util.GetTestChainID(), lcChaincodeInvocationSpec, creator)
}
开发者ID:hyperledger,项目名称:fabric,代码行数:16,代码来源:chaincode.go
示例12: TestDeploy
//TestDeploy deploy chaincode example01
func TestDeploy(t *testing.T) {
chainID := util.GetTestChainID()
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: "ex01", Path: "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01"}, CtorMsg: &pb.ChaincodeInput{Args: [][]byte{[]byte("init"), []byte("a"), []byte("100"), []byte("b"), []byte("200")}}}
cccid := chaincode.NewCCContext(chainID, "ex01", "", "", false, nil)
_, _, err := deploy(endorserServer, chainID, spec, nil)
if err != nil {
t.Fail()
t.Logf("Deploy-error in deploy %s", err)
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:16,代码来源:endorser_test.go
示例13: TestDeployAndInvoke
// TestDeployAndInvoke deploys and invokes chaincode_example01
func TestDeployAndInvoke(t *testing.T) {
chainID := util.GetTestChainID()
var ctxt = context.Background()
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01"
chaincodeID := &pb.ChaincodeID{Path: url, Name: "ex01"}
args := []string{"10"}
f := "init"
argsDeploy := util.ToChaincodeArgs(f, "a", "100", "b", "200")
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: chaincodeID, CtorMsg: &pb.ChaincodeInput{Args: argsDeploy}}
cccid := chaincode.NewCCContext(chainID, "ex01", "", "", false, nil)
resp, prop, err := deploy(endorserServer, chainID, spec, nil)
chaincodeID1 := spec.ChaincodeID.Name
if err != nil {
t.Fail()
t.Logf("Error deploying <%s>: %s", chaincodeID1, err)
chaincode.GetChain().Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
return
}
err = endorserServer.(*Endorser).commitTxSimulation(prop, chainID, signer, resp)
if err != nil {
t.Fail()
t.Logf("Error committing <%s>: %s", chaincodeID1, err)
chaincode.GetChain().Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
return
}
f = "invoke"
invokeArgs := append([]string{f}, args...)
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: chaincodeID, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs(invokeArgs...)}}
resp, err = invoke(chainID, spec)
if err != nil {
t.Fail()
t.Logf("Error invoking transaction: %s", err)
chaincode.GetChain().Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
return
}
fmt.Printf("Invoke test passed\n")
t.Logf("Invoke test passed")
chaincode.GetChain().Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:49,代码来源:endorser_test.go
示例14: createTx
func createTx() (*common.Envelope, error) {
cis := &peer.ChaincodeInvocationSpec{ChaincodeSpec: &peer.ChaincodeSpec{ChaincodeID: &peer.ChaincodeID{Name: "foo"}}}
uuid := util.GenerateUUID()
prop, err := utils.CreateProposalFromCIS(uuid, util.GetTestChainID(), cis, sid)
if err != nil {
return nil, err
}
presp, err := utils.CreateProposalResponse(prop.Header, prop.Payload, []byte("res"), nil, nil, id)
if err != nil {
return nil, err
}
return utils.CreateSignedTx(prop, id, presp)
}
开发者ID:hyperledger,项目名称:fabric,代码行数:17,代码来源:validator_onevalidsignature_test.go
示例15: TestDeployBadPayload
//TestDeployBadPayload set payload to nil and do a deploy. It should fail and example02 should not be deployed
func TestDeployBadPayload(t *testing.T) {
chainID := util.GetTestChainID()
//invalid arguments
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: "ex02", Path: "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"}, CtorMsg: &pb.ChaincodeInput{Args: [][]byte{[]byte("init"), []byte("a"), []byte("100"), []byte("b"), []byte("200")}}}
cccid := chaincode.NewCCContext(chainID, "ex02", "", "", false, nil)
f := func(cds *pb.ChaincodeDeploymentSpec) {
cds.CodePackage = nil
}
_, _, err := deploy(endorserServer, chainID, spec, f)
if err == nil {
t.Fail()
t.Log("DeployBadPayload-expected error in deploy but succeeded")
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
return
}
chaincode.GetChain().Stop(context.Background(), cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:20,代码来源:endorser_test.go
示例16: LoadFakeSetupWithLocalMspAndTestChainMsp
// FIXME: this is required for now because we need a local MSP
// and also the MSP mgr for the test chain; as soon as the code
// to setup chains is ready, the chain should be setup using
// the method below and this method should disappear
func LoadFakeSetupWithLocalMspAndTestChainMsp(dir string) error {
conf, err := msp.GetLocalMspConfig(dir)
if err != nil {
return err
}
err = GetLocalMSP().Setup(conf)
if err != nil {
return err
}
fakeConfig := []*mspprotos.MSPConfig{conf}
err = GetManagerForChain(util.GetTestChainID()).Setup(fakeConfig)
if err != nil {
return err
}
return nil
}
开发者ID:hyperledger,项目名称:fabric,代码行数:24,代码来源:config.go
示例17: AddFlags
func AddFlags(cmd *cobra.Command) {
flags := cmd.PersistentFlags()
flags.StringVarP(&chaincodeLang, "lang", "l", "golang",
fmt.Sprintf("Language the %s is written in", chainFuncName))
flags.StringVarP(&chaincodeCtorJSON, "ctor", "c", "{}",
fmt.Sprintf("Constructor message for the %s in JSON format", chainFuncName))
flags.StringVarP(&chaincodeAttributesJSON, "attributes", "a", "[]",
fmt.Sprintf("User attributes for the %s in JSON format", chainFuncName))
flags.StringVarP(&chaincodePath, "path", "p", common.UndefinedParamValue,
fmt.Sprintf("Path to %s", chainFuncName))
flags.StringVarP(&chaincodeName, "name", "n", common.UndefinedParamValue,
fmt.Sprint("Name of the chaincode returned by the deploy transaction"))
flags.StringVarP(&chaincodeUsr, "username", "u", common.UndefinedParamValue,
fmt.Sprint("Username for chaincode operations when security is enabled"))
flags.StringVarP(&customIDGenAlg, "tid", "t", common.UndefinedParamValue,
fmt.Sprint("Name of a custom ID generation algorithm (hashing and decoding) e.g. sha256base64"))
flags.StringVarP(&chainID, "chainID", "C", util.GetTestChainID(),
fmt.Sprint("The chain on which this command should be executed"))
}
开发者ID:hyperledger,项目名称:fabric,代码行数:20,代码来源:chaincode.go
示例18: TestChaincodeInvokeChaincode
// Test the execution of a chaincode that invokes another chaincode.
func TestChaincodeInvokeChaincode(t *testing.T) {
chainID := util.GetTestChainID()
lis, err := initPeer(chainID)
if err != nil {
t.Fail()
t.Logf("Error creating peer: %s", err)
}
defer finitPeer(lis, chainID)
err = chaincodeInvokeChaincode(t, chainID, "")
if err != nil {
t.Fail()
t.Logf("Failed chaincode invoke chaincode : %s", err)
closeListenerAndSleep(lis)
return
}
closeListenerAndSleep(lis)
}
开发者ID:hyperledger,项目名称:fabric,代码行数:22,代码来源:exectransaction_test.go
示例19: TestMain
func TestMain(m *testing.M) {
SetupTestConfig()
viper.Set("peer.fileSystemPath", filepath.Join(os.TempDir(), "hyperledger", "production"))
chainID := util.GetTestChainID()
lis, err := initPeer(chainID)
if err != nil {
os.Exit(-1)
fmt.Printf("Could not initialize tests")
finitPeer(lis)
return
}
endorserServer = NewEndorserServer()
// setup the MSP manager so that we can sign/verify
mspMgrConfigDir := "../../msp/sampleconfig/"
err = mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)
if err != nil {
fmt.Printf("Could not initialize msp/signer, err %s", err)
os.Exit(-1)
finitPeer(lis)
return
}
signer, err = mspmgmt.GetLocalMSP().GetDefaultSigningIdentity()
if err != nil {
fmt.Printf("Could not initialize msp/signer")
os.Exit(-1)
finitPeer(lis)
return
}
retVal := m.Run()
finitPeer(lis)
os.Exit(retVal)
}
开发者ID:hyperledger,项目名称:fabric,代码行数:38,代码来源:endorser_test.go
示例20: TestExecuteInvokeInvalidTransaction
// Test the execution of an invalid transaction.
func TestExecuteInvokeInvalidTransaction(t *testing.T) {
chainID := util.GetTestChainID()
lis, err := initPeer(chainID)
if err != nil {
t.Fail()
t.Logf("Error creating peer: %s", err)
}
defer finitPeer(lis, chainID)
var ctxt = context.Background()
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
chaincodeID := &pb.ChaincodeID{Name: "example02", Path: url}
cccid := NewCCContext(chainID, "example02", "", "", false, nil)
//FAIL, FAIL!
args := []string{"x", "-1"}
err = invokeExample02Transaction(ctxt, cccid, chaincodeID, args, false)
//this HAS to fail with expectedDeltaStringPrefix
if err != nil {
errStr := err.Error()
t.Logf("Got error %s\n", errStr)
t.Logf("InvalidInvoke test passed")
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
return
}
t.Fail()
t.Logf("Error invoking transaction %s", err)
theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeID: chaincodeID}})
}
开发者ID:hyperledger,项目名称:fabric,代码行数:38,代码来源:exectransaction_test.go
注:本文中的github.com/hyperledger/fabric/core/util.GetTestChainID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论