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

Commit acb200e

Browse files
committed
[FAB-9596] ChClientOptions vs ResMgmtOptions
Change-Id: I058ae46dfd0b6afa933d52e60fb579d62cbd4fb7 Signed-off-by: Sandra Vrtikapa <sandra.vrtikapa@securekey.com>
1 parent 95c8574 commit acb200e

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

pkg/common/errors/retry/defaults.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ var DefaultOpts = Opts{
4747
RetryableCodes: DefaultRetryableCodes,
4848
}
4949

50-
// DefaultChClientOpts default retry options for the channel client
51-
var DefaultChClientOpts = Opts{
50+
// DefaultChannelOpts default retry options for the channel client
51+
var DefaultChannelOpts = Opts{
5252
Attempts: DefaultAttempts,
5353
InitialBackoff: DefaultInitialBackoff,
5454
MaxBackoff: DefaultMaxBackoff,

test/integration/e2e/end_to_end.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ func verifyFundsIsMoved(client *channel.Client, t *testing.T, value []byte) {
141141

142142
func executeCC(client *channel.Client, t *testing.T) {
143143
_, err := client.Execute(channel.Request{ChaincodeID: ccID, Fcn: "invoke", Args: integration.ExampleCCTxArgs()},
144-
channel.WithRetry(retry.DefaultChClientOpts))
144+
channel.WithRetry(retry.DefaultChannelOpts))
145145
if err != nil {
146146
t.Fatalf("Failed to move funds: %s", err)
147147
}
148148
}
149149

150150
func queryCC(client *channel.Client, t *testing.T) []byte {
151151
response, err := client.Query(channel.Request{ChaincodeID: ccID, Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
152-
channel.WithRetry(retry.DefaultChClientOpts))
152+
channel.WithRetry(retry.DefaultChannelOpts))
153153
if err != nil {
154154
t.Fatalf("Failed to query funds: %s", err)
155155
}

test/integration/orgs/multiple_orgs_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ func createChannel(org1AdminUser msp.SigningIdentity, org2AdminUser msp.SigningI
229229

230230
func testCCPolicy(chClientOrg2User *channel.Client, t *testing.T) {
231231
_, err := chClientOrg2User.Execute(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCTxArgs()}, channel.WithTargets(orgTestPeer1),
232-
channel.WithRetry(retry.DefaultChClientOpts))
232+
channel.WithRetry(retry.DefaultChannelOpts))
233233
if err == nil {
234234
t.Fatalf("Should have failed to move funds due to cc policy")
235235
}
236236
// Org2 user moves funds (cc policy ok since we have provided peers for both Orgs)
237237
_, err = chClientOrg2User.Execute(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCTxArgs()}, channel.WithTargets(orgTestPeer0, orgTestPeer1),
238-
channel.WithRetry(retry.DefaultChClientOpts))
238+
channel.WithRetry(retry.DefaultChannelOpts))
239239
if err != nil {
240240
t.Fatalf("Failed to move funds: %s", err)
241241
}
@@ -266,7 +266,7 @@ func upgradeCC(ccPkg *api.CCPackage, org1ResMgmt *resmgmt.Client, t *testing.T,
266266

267267
func moveFunds(chClientOrgUser *channel.Client, t *testing.T) fab.TransactionID {
268268
response, err := chClientOrgUser.Execute(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCTxArgs()}, channel.WithTargets(orgTestPeer1),
269-
channel.WithRetry(retry.DefaultChClientOpts))
269+
channel.WithRetry(retry.DefaultChannelOpts))
270270
if err != nil {
271271
t.Fatalf("Failed to move funds: %s", err)
272272
}
@@ -308,7 +308,7 @@ func getBlockchainInfo(ledgerClient *ledger.Client, t *testing.T) *fab.Blockchai
308308

309309
func queryCC(chClientOrg1User *channel.Client, t *testing.T) []byte {
310310
response, err := chClientOrg1User.Query(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
311-
channel.WithRetry(retry.DefaultChClientOpts))
311+
channel.WithRetry(retry.DefaultChannelOpts))
312312
if err != nil {
313313
t.Fatalf("Failed to query funds: %s", err)
314314
}
@@ -323,7 +323,7 @@ func queryCC(chClientOrg1User *channel.Client, t *testing.T) []byte {
323323

324324
func verifyErrorFromCC(chClientOrg1User *channel.Client, t *testing.T) {
325325
_, err := chClientOrg1User.Query(channel.Request{ChaincodeID: "exampleCC", Fcn: "DUMMY_FUNCTION", Args: integration.ExampleCCQueryArgs()},
326-
channel.WithRetry(retry.DefaultChClientOpts))
326+
channel.WithRetry(retry.DefaultChannelOpts))
327327
require.Error(t, err, "Should have failed with dummy function")
328328
s, ok := status.FromError(err)
329329
require.True(t, ok, "expected status error")
@@ -396,7 +396,7 @@ func testWithOrg2(t *testing.T, expectedValue int) int {
396396

397397
// Org2 user moves funds (dynamic selection will inspect chaincode policy to determine endorsers)
398398
_, err = chClientOrg2User.Execute(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCTxArgs()},
399-
channel.WithRetry(retry.DefaultChClientOpts))
399+
channel.WithRetry(retry.DefaultChannelOpts))
400400
if err != nil {
401401
t.Fatalf("Failed to move funds: %s", err)
402402
}
@@ -425,7 +425,7 @@ func verifyValue(t *testing.T, chClient *channel.Client, expected int) {
425425
for i := 0; i < pollRetries; i++ {
426426
// Query final value on org1 peer
427427
response, err := chClient.Query(channel.Request{ChaincodeID: "exampleCC", Fcn: "invoke", Args: integration.ExampleCCQueryArgs()}, channel.WithTargets(orgTestPeer0),
428-
channel.WithRetry(retry.DefaultChClientOpts))
428+
channel.WithRetry(retry.DefaultChannelOpts))
429429
if err != nil {
430430
t.Fatalf("Failed to query funds after transaction: %s", err)
431431
}

test/integration/sdk/channel_client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestChannelClient(t *testing.T) {
107107
func testQuery(expected string, ccID string, chClient *channel.Client, t *testing.T) {
108108

109109
response, err := chClient.Query(channel.Request{ChaincodeID: ccID, Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
110-
channel.WithRetry(retry.DefaultChClientOpts))
110+
channel.WithRetry(retry.DefaultChannelOpts))
111111
if err != nil {
112112
t.Fatalf("Failed to invoke example cc: %s", err)
113113
}
@@ -119,7 +119,7 @@ func testQuery(expected string, ccID string, chClient *channel.Client, t *testin
119119

120120
func testQueryWithOpts(expected string, ccID string, chClient *channel.Client, t *testing.T) {
121121
response, err := chClient.Query(channel.Request{ChaincodeID: ccID, Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
122-
channel.WithRetry(retry.DefaultChClientOpts))
122+
channel.WithRetry(retry.DefaultChannelOpts))
123123
if err != nil {
124124
t.Fatalf("Query returned error: %s", err)
125125
}
@@ -130,7 +130,7 @@ func testQueryWithOpts(expected string, ccID string, chClient *channel.Client, t
130130

131131
func testTransaction(ccID string, chClient *channel.Client, t *testing.T) {
132132
response, err := chClient.Execute(channel.Request{ChaincodeID: ccID, Fcn: "invoke", Args: integration.ExampleCCTxArgs()},
133-
channel.WithRetry(retry.DefaultChClientOpts))
133+
channel.WithRetry(retry.DefaultChannelOpts))
134134
if err != nil {
135135
t.Fatalf("Failed to move funds: %s", err)
136136
}
@@ -296,7 +296,7 @@ func testChaincodeEventListener(ccID string, chClient *channel.Client, listener
296296
func testChaincodeError(ccID string, client *channel.Client, t *testing.T) {
297297
// Try calling unknown function call and expect an error
298298
_, err := client.Execute(channel.Request{ChaincodeID: ccID, Fcn: "DUMMY_FUNCTION", Args: integration.ExampleCCTxArgs()},
299-
channel.WithRetry(retry.DefaultChClientOpts))
299+
channel.WithRetry(retry.DefaultChannelOpts))
300300
require.Error(t, err)
301301
s, ok := status.FromError(err)
302302
require.True(t, ok, "expected status error")
@@ -326,14 +326,14 @@ func TestNoEndpoints(t *testing.T) {
326326

327327
// Test query chaincode: since peer has been disabled for chaincode query this query should fail
328328
_, err = chClient.Query(channel.Request{ChaincodeID: mainChaincodeID, Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
329-
channel.WithRetry(retry.DefaultChClientOpts))
329+
channel.WithRetry(retry.DefaultChannelOpts))
330330
if err == nil || !strings.Contains(err.Error(), "targets were not provided") {
331331
t.Fatalf("Should have failed due to no chaincode query peers")
332332
}
333333

334334
// Test execute transaction: since peer has been disabled for endorsement this transaction should fail
335335
_, err = chClient.Execute(channel.Request{ChaincodeID: mainChaincodeID, Fcn: "invoke", Args: integration.ExampleCCTxArgs()},
336-
channel.WithRetry(retry.DefaultChClientOpts))
336+
channel.WithRetry(retry.DefaultChannelOpts))
337337
if err == nil || !strings.Contains(err.Error(), "targets were not provided") {
338338
t.Fatalf("Should have failed due to no endorsing peers")
339339
}

test/integration/sdk/sdk_provider_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ func TestDynamicSelection(t *testing.T) {
6666
}
6767

6868
response, err := chClient.Query(channel.Request{ChaincodeID: chainCodeID, Fcn: "invoke", Args: integration.ExampleCCQueryArgs()},
69-
channel.WithRetry(retry.DefaultChClientOpts))
69+
channel.WithRetry(retry.DefaultChannelOpts))
7070
if err != nil {
7171
t.Fatalf("Failed to query funds: %s", err)
7272
}
7373
value := response.Payload
7474

7575
// Move funds
7676
response, err = chClient.Execute(channel.Request{ChaincodeID: chainCodeID, Fcn: "invoke", Args: integration.ExampleCCTxArgs()},
77-
channel.WithRetry(retry.DefaultChClientOpts))
77+
channel.WithRetry(retry.DefaultChannelOpts))
7878
if err != nil {
7979
t.Fatalf("Failed to move funds: %s", err)
8080
}

0 commit comments

Comments
 (0)