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

Commit 91dfe65

Browse files
author
Firas Qutishat
committed
[FAB-9312] Resolve metalinter warnings
- fix test pkg Change-Id: Ib26d9ee23cb147bcda88063e1a82f6aec8ab88e2 Signed-off-by: Firas Qutishat <firas.qutishat@securekey.com>
1 parent 03d5b1d commit 91dfe65

18 files changed

+246
-312
lines changed

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ depend-install:
187187
@FABRIC_SDKGO_DEPEND_INSTALL="true" $(TEST_SCRIPTS_PATH)/dependencies.sh
188188

189189
.PHONY: checks
190-
checks: depend license lint spelling
190+
checks: depend license lint
191191

192192
.PHONY: license
193193
license:
@@ -197,9 +197,6 @@ license:
197197
lint: populate
198198
@$(TEST_SCRIPTS_PATH)/check_lint.sh
199199

200-
.PHONY: spelling
201-
spelling:
202-
@$(TEST_SCRIPTS_PATH)/check_spelling.sh
203200

204201
.PHONY: build-softhsm2-image
205202
build-softhsm2-image:

gometalinter.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"Exclude": [
44
".*seekInfo can be .*proto.Message.*",
55
"test/integration/msp/check_cert_attributes.go",
6-
"test/integration/msp/check_cert_ser_attributes_prev.go"
6+
"test/integration/msp/check_cert_ser_attributes_prev.go",
7+
"test/fixtures/testdata/..."
78
],
89
"EnableGC": true,
910
"WarnUnmatchedDirective": true,

test/integration/base_test_setup.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"os"
1111
"path"
1212

13+
"fmt"
14+
1315
"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
1416
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry"
1517
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
@@ -94,7 +96,12 @@ func (setup *BaseSetupImpl) Initialize(sdk *fabsdk.FabricSDK) error {
9496
if err != nil {
9597
return errors.Wrapf(err, "opening channel config file failed")
9698
}
97-
defer r.Close()
99+
defer func() {
100+
if err = r.Close(); err != nil {
101+
fmt.Printf("close error %v\n", err)
102+
}
103+
104+
}()
98105

99106
// Create channel for tests
100107
req := resmgmt.SaveChannelRequest{ChannelID: setup.ChannelID, ChannelConfig: r, SigningIdentities: []msp.SigningIdentity{adminIdentity}}

test/integration/e2e/end_to_end_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ func TestE2E(t *testing.T) {
1919
Run(t, config.FromFile("../../fixtures/config/config_test.yaml"))
2020

2121
//Using setup done set above by end to end test, run below test with new config which has no orderer config inside
22-
RunWithNoOrdererConfig(t, integration.ConfigNoOrdererBackend)
22+
runWithNoOrdererConfig(t, integration.ConfigNoOrdererBackend)
2323
}

test/integration/e2e/no_orderer_config.go renamed to test/integration/e2e/no_orderer_config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"github.com/hyperledger/fabric-sdk-go/test/integration"
1919
)
2020

21-
// RunWithNoOrdererConfig enables chclient scenarios using config and sdk options provided
22-
func RunWithNoOrdererConfig(t *testing.T, configOpt core.ConfigProvider, sdkOpts ...fabsdk.Option) {
21+
// runWithNoOrdererConfig enables chclient scenarios using config and sdk options provided
22+
func runWithNoOrdererConfig(t *testing.T, configOpt core.ConfigProvider, sdkOpts ...fabsdk.Option) {
2323

2424
sdk, err := fabsdk.New(configOpt, sdkOpts...)
2525
if err != nil {

test/integration/env.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ func addLocalEntityMappingToBackend(backend core.ConfigBackend) (core.ConfigBack
9999
networkConfig := fab.NetworkConfig{}
100100
configLookup := lookup.New(backend)
101101

102-
configLookup.UnmarshalKey("orderers", &networkConfig.Orderers)
103-
configLookup.UnmarshalKey("peers", &networkConfig.Peers)
104-
102+
if err = configLookup.UnmarshalKey("orderers", &networkConfig.Orderers); err != nil {
103+
return nil, err
104+
}
105+
if err = configLookup.UnmarshalKey("peers", &networkConfig.Peers); err != nil {
106+
return nil, err
107+
}
105108
orderer, ok := networkConfig.Orderers["local.orderer.example.com"]
106109
if ok {
107110
orderer.URL = re.ReplaceAllString(orderer.URL, "localhost:")

0 commit comments

Comments
 (0)