Skip to content

Commit

Permalink
Merge "[FAB-12464] add explicit retry for CC2CC test"
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Likic authored and Gerrit Code Review committed Nov 20, 2018
2 parents 2c76aff + 1dcd233 commit 1e9726a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions test/integration/pkg/client/channel/channel_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0
package channel

import (
"fmt"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -267,14 +268,22 @@ func TestCCToCC(t *testing.T) {
),
),
)
_, err = chClient.InvokeHandler(
handler,
channel.Request{
ChaincodeID: cc1ID,
Fcn: "invokecc",
Args: [][]byte{[]byte(cc2ID), []byte(`{"Args":["invoke","set","x1","y1"]}`)},
_, err = retry.NewInvoker(retry.New(retry.TestRetryOpts)).Invoke(
func() (interface{}, error) {
b, e := chClient.InvokeHandler(
handler,
channel.Request{
ChaincodeID: cc1ID,
Fcn: "invokecc",
Args: [][]byte{[]byte(cc2ID), []byte(`{"Args":["invoke","set","x1","y1"]}`)},
},
channel.WithRetry(retry.DefaultChannelOpts),
)
if e != nil && strings.Contains(e.Error(), "500") {
return nil, status.New(status.TestStatus, status.GenericTransient.ToInt32(), fmt.Sprintf("invokecc with policy returned unexpected error: %v", e), nil)
}
return b, e
},
channel.WithRetry(retry.DefaultChannelOpts),
)
require.Errorf(t, err, "expecting transaction to fail due to endorsement policy not being satisfied")
stat, ok := status.FromError(err)
Expand Down

0 comments on commit 1e9726a

Please sign in to comment.