Skip to content

Commit

Permalink
[FAB-9312] Resolve metalinter warnings
Browse files Browse the repository at this point in the history
- fix test pkg

Change-Id: Ib26d9ee23cb147bcda88063e1a82f6aec8ab88e2
Signed-off-by: Firas Qutishat <firas.qutishat@securekey.com>
  • Loading branch information
fqutishat committed Apr 17, 2018
1 parent 03d5b1d commit 91dfe65
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 312 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ depend-install:
@FABRIC_SDKGO_DEPEND_INSTALL="true" $(TEST_SCRIPTS_PATH)/dependencies.sh

.PHONY: checks
checks: depend license lint spelling
checks: depend license lint

.PHONY: license
license:
Expand All @@ -197,9 +197,6 @@ license:
lint: populate
@$(TEST_SCRIPTS_PATH)/check_lint.sh

.PHONY: spelling
spelling:
@$(TEST_SCRIPTS_PATH)/check_spelling.sh

.PHONY: build-softhsm2-image
build-softhsm2-image:
Expand Down
3 changes: 2 additions & 1 deletion gometalinter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"Exclude": [
".*seekInfo can be .*proto.Message.*",
"test/integration/msp/check_cert_attributes.go",
"test/integration/msp/check_cert_ser_attributes_prev.go"
"test/integration/msp/check_cert_ser_attributes_prev.go",
"test/fixtures/testdata/..."
],
"EnableGC": true,
"WarnUnmatchedDirective": true,
Expand Down
9 changes: 8 additions & 1 deletion test/integration/base_test_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"os"
"path"

"fmt"

"github.com/hyperledger/fabric-sdk-go/pkg/client/resmgmt"
"github.com/hyperledger/fabric-sdk-go/pkg/common/errors/retry"
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/core"
Expand Down Expand Up @@ -94,7 +96,12 @@ func (setup *BaseSetupImpl) Initialize(sdk *fabsdk.FabricSDK) error {
if err != nil {
return errors.Wrapf(err, "opening channel config file failed")
}
defer r.Close()
defer func() {
if err = r.Close(); err != nil {
fmt.Printf("close error %v\n", err)
}

}()

// Create channel for tests
req := resmgmt.SaveChannelRequest{ChannelID: setup.ChannelID, ChannelConfig: r, SigningIdentities: []msp.SigningIdentity{adminIdentity}}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/e2e/end_to_end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ func TestE2E(t *testing.T) {
Run(t, config.FromFile("../../fixtures/config/config_test.yaml"))

//Using setup done set above by end to end test, run below test with new config which has no orderer config inside
RunWithNoOrdererConfig(t, integration.ConfigNoOrdererBackend)
runWithNoOrdererConfig(t, integration.ConfigNoOrdererBackend)
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/hyperledger/fabric-sdk-go/test/integration"
)

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

sdk, err := fabsdk.New(configOpt, sdkOpts...)
if err != nil {
Expand Down
9 changes: 6 additions & 3 deletions test/integration/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ func addLocalEntityMappingToBackend(backend core.ConfigBackend) (core.ConfigBack
networkConfig := fab.NetworkConfig{}
configLookup := lookup.New(backend)

configLookup.UnmarshalKey("orderers", &networkConfig.Orderers)
configLookup.UnmarshalKey("peers", &networkConfig.Peers)

if err = configLookup.UnmarshalKey("orderers", &networkConfig.Orderers); err != nil {
return nil, err
}
if err = configLookup.UnmarshalKey("peers", &networkConfig.Peers); err != nil {
return nil, err
}
orderer, ok := networkConfig.Orderers["local.orderer.example.com"]
if ok {
orderer.URL = re.ReplaceAllString(orderer.URL, "localhost:")
Expand Down
Loading

0 comments on commit 91dfe65

Please sign in to comment.