add explicit retry for CC2CC test
@@ -7,6 +7,7 @@ SPDX-License-Identifier: Apache-2.0
package channel
import (
+ "fmt"
"strings"
"sync"
"testing"
@@ -267,7 +268,9 @@ func TestCCToCC(t *testing.T) {
),
),
)
- _, err = chClient.InvokeHandler(
+ _, err = retry.NewInvoker(retry.New(retry.TestRetryOpts)).Invoke(
+ func() (interface{}, error) {
+ b, e := chClient.InvokeHandler(
handler,
channel.Request{
ChaincodeID: cc1ID,
@@ -276,6 +279,12 @@ func TestCCToCC(t *testing.T) {
},
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
+ },
+ )
require.Errorf(t, err, "expecting transaction to fail due to endorsement policy not being satisfied")
stat, ok := status.FromError(err)
assert.Truef(t, ok, "Expecting a status error")
