Skip to content

Commit

Permalink
[FAB-6762] Update chaincode startup timeout for tests
Browse files Browse the repository at this point in the history
Due to the updated use of the chaincode startup timeout that was
merged via FAB-5591, this CR updates the chaincode tests to use larger
chaincode startup timeout values to ensure there are not any unintended
test failures.

Change-Id: I6372c3b079f23509f40131c8c4aee024a58d6654
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed Oct 25, 2017
1 parent 58aeb3f commit 43d3e63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/chaincode/chaincode_support_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func initMockPeer(chainIDs ...string) error {
return &pb.PeerEndpoint{Id: &pb.PeerID{Name: "testpeer"}}, nil
}

ccStartupTimeout := time.Duration(2) * time.Second
ccStartupTimeout := time.Duration(10) * time.Second
ca, _ := accesscontrol.NewCA()
NewChaincodeSupport(getPeerEndpoint, false, ccStartupTimeout, ca)
theChaincodeSupport.executetimeout = time.Duration(1) * time.Second
Expand Down Expand Up @@ -863,7 +863,7 @@ func getLaunchConfigs(t *testing.T, auth accesscontrol.Authenticator) {

//success case
func TestLaunchAndWaitSuccess(t *testing.T) {
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(500) * time.Millisecond, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(10) * time.Second, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeId: &pb.ChaincodeID{Name: "testcc", Version: "0"}}
code := getTarGZ(t, "src/dummy/dummy.go", []byte("code"))
cds := &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: code}
Expand Down Expand Up @@ -896,7 +896,7 @@ func TestLaunchAndWaitTimeout(t *testing.T) {

//test notification error case
func TestLaunchAndWaitNotificationError(t *testing.T) {
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(500) * time.Millisecond, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(10) * time.Second, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeId: &pb.ChaincodeID{Name: "testcc", Version: "0"}}
code := getTarGZ(t, "src/dummy/dummy.go", []byte("code"))
cds := &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: code}
Expand All @@ -912,7 +912,7 @@ func TestLaunchAndWaitNotificationError(t *testing.T) {

//test container return error
func TestLaunchAndWaitLaunchError(t *testing.T) {
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(500) * time.Millisecond, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
newCCSupport := &ChaincodeSupport{peerTLS: true, chaincodeLogLevel: "debug", shimLogLevel: "info", ccStartupTimeout: time.Duration(10) * time.Second, runningChaincodes: &runningChaincodes{chaincodeMap: make(map[string]*chaincodeRTEnv), launchStarted: make(map[string]bool)}, peerNetworkID: "networkID", peerID: "peerID"}
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeId: &pb.ChaincodeID{Name: "testcc", Version: "0"}}
code := getTarGZ(t, "src/dummy/dummy.go", []byte("code"))
cds := &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: code}
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func initPeer(chainIDs ...string) (net.Listener, error) {
return &pb.PeerEndpoint{Id: &pb.PeerID{Name: "testpeer"}, Address: peerAddress}, nil
}

ccStartupTimeout := time.Duration(chaincodeStartupTimeoutDefault) * time.Millisecond
ccStartupTimeout := time.Duration(60) * time.Second
ca, _ := accesscontrol.NewCA()
pb.RegisterChaincodeSupportServer(grpcServer, NewChaincodeSupport(getPeerEndpoint, false, ccStartupTimeout, ca))

Expand Down

0 comments on commit 43d3e63

Please sign in to comment.