Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit de259d3

Browse files
committed
[FABG-773] CI test failure fixes
- instead of default retry opts which runs for only few seconds, used test retry opts for integration-tests to make them work even in slowest of environments Change-Id: I4ca4b9612c27a383620ffd7d0ec7330bfd70a050 Signed-off-by: Sudesh Shetty <sudesh.shetty@securekey.com>
1 parent 8b2e7a2 commit de259d3

File tree

5 files changed

+43
-15
lines changed

5 files changed

+43
-15
lines changed

pkg/common/errors/retry/defaults.go

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,37 @@ var TestRetryableCodes = map[status.Group][]status.Code{
170170
status.TestStatus: {
171171
status.GenericTransient,
172172
},
173+
status.DiscoveryServerStatus: {
174+
status.QueryEndorsers,
175+
},
176+
status.EndorserClientStatus: {
177+
status.ConnectionFailed, status.EndorsementMismatch,
178+
status.PrematureChaincodeExecution,
179+
status.ChaincodeAlreadyLaunching,
180+
status.ChaincodeNameNotFound,
181+
},
182+
status.EndorserServerStatus: {
183+
status.Code(common.Status_SERVICE_UNAVAILABLE),
184+
status.Code(common.Status_INTERNAL_SERVER_ERROR),
185+
},
186+
status.OrdererClientStatus: {
187+
status.ConnectionFailed,
188+
},
189+
status.OrdererServerStatus: {
190+
status.Code(common.Status_SERVICE_UNAVAILABLE),
191+
status.Code(common.Status_INTERNAL_SERVER_ERROR),
192+
},
193+
status.EventServerStatus: {
194+
status.Code(pb.TxValidationCode_DUPLICATE_TXID),
195+
status.Code(pb.TxValidationCode_ENDORSEMENT_POLICY_FAILURE),
196+
status.Code(pb.TxValidationCode_MVCC_READ_CONFLICT),
197+
status.Code(pb.TxValidationCode_PHANTOM_READ_CONFLICT),
198+
},
199+
// TODO: gRPC introduced retries in v1.8.0. This can be replaced with the
200+
// gRPC fail fast option, once available
201+
status.GRPCTransportStatus: {
202+
status.Code(grpcCodes.Unavailable),
203+
},
173204
}
174205

175206
const (
@@ -178,7 +209,7 @@ const (
178209
// TestInitialBackoff default initial backoff
179210
TestInitialBackoff = 200 * time.Millisecond
180211
// TestMaxBackoff default maximum backoff
181-
TestMaxBackoff = 5 * time.Second
212+
TestMaxBackoff = 50 * time.Second
182213
// TestBackoffFactor default backoff factor
183214
TestBackoffFactor = 1.75
184215
)

test/fixtures/dockerenv/prev-env.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
# This file contains environment overrides to enable testing
99
# against the latest pre-release target.
1010

11-
# Temporarily override FABRIC-ARCH until latest prev follows new naming conventions.
12-
#export FABRIC_ARCH="amd64"
13-
#export FABRIC_ARCH_SEP="-"
14-
1511
export FABRIC_FIXTURE_VERSION="v1.2"
1612
export FABRIC_CRYPTOCONFIG_VERSION="v1"
1713

test/integration/pkg/client/channel/channel_client_pvt_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ import (
1414
"sync"
1515
"testing"
1616

17+
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry"
18+
1719
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/multi"
1820
"github.com/stretchr/testify/assert"
1921

2022
"github.com/stretchr/testify/require"
2123

2224
"github.com/hyperledger/fabric-sdk-go/pkg/client/channel"
23-
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry"
2425
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
2526
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/common/cauthdsl"
2627
cb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
@@ -60,7 +61,7 @@ func TestPrivateDataPutAndGet(t *testing.T) {
6061
Fcn: "putprivate",
6162
Args: [][]byte{[]byte(coll1), []byte("pvtKet"), []byte(value)},
6263
},
63-
channel.WithRetry(retry.DefaultChannelOpts),
64+
channel.WithRetry(retry.TestRetryOpts),
6465
)
6566
require.NoError(t, err)
6667
require.NotEmptyf(t, response.Responses, "expecting at least one response")
@@ -71,7 +72,7 @@ func TestPrivateDataPutAndGet(t *testing.T) {
7172
Fcn: "getprivate",
7273
Args: [][]byte{[]byte(coll1), []byte("pvtKet")},
7374
},
74-
channel.WithRetry(retry.DefaultChannelOpts),
75+
channel.WithRetry(retry.TestRetryOpts),
7576
)
7677
require.NoError(t, err)
7778
t.Logf("Got response payload: %s", string(response.Payload))
@@ -113,7 +114,7 @@ func TestPrivateData(t *testing.T) {
113114
{ID: ccID, Collections: []string{coll1}},
114115
},
115116
},
116-
channel.WithRetry(retry.DefaultChannelOpts),
117+
channel.WithRetry(retry.TestRetryOpts),
117118
)
118119
require.NoError(t, err)
119120
t.Logf("Got %d response(s)", len(response.Responses))
@@ -127,7 +128,7 @@ func TestPrivateData(t *testing.T) {
127128
Fcn: "putprivate",
128129
Args: [][]byte{[]byte(coll1), []byte("key"), []byte("value")},
129130
},
130-
channel.WithRetry(retry.DefaultChannelOpts),
131+
channel.WithRetry(retry.TestRetryOpts),
131132
)
132133
require.NoError(t, err)
133134
t.Logf("Got %d response(s)", len(response.Responses))
@@ -172,7 +173,7 @@ func TestPrivateDataWithOrgDown(t *testing.T) {
172173
{ID: ccID, Collections: []string{coll1}},
173174
},
174175
},
175-
channel.WithRetry(retry.DefaultChannelOpts),
176+
channel.WithRetry(retry.TestRetryOpts),
176177
)
177178
require.Errorf(t, err, "expecting error due to all Org2MSP peers down")
178179
})
@@ -184,7 +185,7 @@ func TestPrivateDataWithOrgDown(t *testing.T) {
184185
Fcn: "putprivate",
185186
Args: [][]byte{[]byte(coll1), []byte("key"), []byte("value")},
186187
},
187-
channel.WithRetry(retry.DefaultChannelOpts),
188+
channel.WithRetry(retry.TestRetryOpts),
188189
)
189190
require.NoError(t, err)
190191
t.Logf("Got %d response(s)", len(response.Responses))
@@ -251,7 +252,7 @@ func TestChannelClientRollsBackPvtDataIfMvccReadConflict(t *testing.T) {
251252
Fcn: "getprivate",
252253
Args: [][]byte{[]byte(coll), []byte(key)},
253254
},
254-
channel.WithRetry(retry.DefaultChannelOpts),
255+
channel.WithRetry(retry.TestRetryOpts),
255256
)
256257
require.NoErrorf(t, err, "error attempting to read private data")
257258

test/integration/pkg/fabsdk/provider/sdk_provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestDynamicSelection(t *testing.T) {
6464
}
6565

6666
response, err := chClient.Query(channel.Request{ChaincodeID: chaincodeID, Fcn: "invoke", Args: queryArg},
67-
channel.WithRetry(retry.DefaultChannelOpts))
67+
channel.WithRetry(retry.TestRetryOpts))
6868
if err != nil {
6969
t.Fatalf("Failed to query funds: %s", err)
7070
}

test/metadata/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SPDX-License-Identifier: Apache-2.0
88
package metadata
99

1010
// ChannelConfigPath is the relative path to the generated channel artifacts directory
11-
var ChannelConfigPath = "test/fixtures/fabric/v1.2/channel"
11+
var ChannelConfigPath = "test/fixtures/fabric/v1.3/channel"
1212

1313
// CryptoConfigPath is the relative path to the generated crypto config directory
1414
var CryptoConfigPath = "test/fixtures/fabric/v1/crypto-config"

0 commit comments

Comments
 (0)