diff --git a/api/apiconfig/config.go b/api/apiconfig/config.go index 15dbbfca02..dd5ec1d650 100644 --- a/api/apiconfig/config.go +++ b/api/apiconfig/config.go @@ -8,6 +8,7 @@ package apiconfig import ( "crypto/x509" + "time" bccspFactory "github.com/hyperledger/fabric/bccsp/factory" ) @@ -18,6 +19,7 @@ type Config interface { CAServerCertFiles(org string) ([]string, error) CAClientKeyFile(org string) (string, error) CAClientCertFile(org string) (string, error) + TimeoutOrDefault(ConnectionType) time.Duration MspID(org string) (string, error) OrderersConfig() ([]OrdererConfig, error) RandomOrdererConfig() (*OrdererConfig, error) @@ -37,3 +39,17 @@ type Config interface { CryptoConfigPath() string CSPConfig() *bccspFactory.FactoryOpts } + +// ConnectionType enumerates the different types of outgoing connections +type ConnectionType int + +const ( + // Endorser connection + Endorser ConnectionType = iota + // EventHub connection + EventHub + // EventReg connection + EventReg + // Orderer connection + Orderer +) diff --git a/api/apiconfig/mocks/mockconfig.gen.go b/api/apiconfig/mocks/mockconfig.gen.go index 9df38c6a99..b53c760331 100644 --- a/api/apiconfig/mocks/mockconfig.gen.go +++ b/api/apiconfig/mocks/mockconfig.gen.go @@ -8,6 +8,7 @@ import ( gomock "github.com/golang/mock/gomock" apiconfig "github.com/hyperledger/fabric-sdk-go/api/apiconfig" factory "github.com/hyperledger/fabric/bccsp/factory" + time "time" ) // MockConfig is a mock of Config interface @@ -306,3 +307,15 @@ func (_m *MockConfig) TcertBatchSize() int { func (_mr *MockConfigMockRecorder) TcertBatchSize() *gomock.Call { return _mr.mock.ctrl.RecordCall(_mr.mock, "TcertBatchSize") } + +// TimeoutOrDefault mocks base method +func (_m *MockConfig) TimeoutOrDefault(_param0 apiconfig.ConnectionType) time.Duration { + ret := _m.ctrl.Call(_m, "TimeoutOrDefault", _param0) + ret0, _ := ret[0].(time.Duration) + return ret0 +} + +// TimeoutOrDefault indicates an expected call of TimeoutOrDefault +func (_mr *MockConfigMockRecorder) TimeoutOrDefault(arg0 interface{}) *gomock.Call { + return _mr.mock.ctrl.RecordCall(_mr.mock, "TimeoutOrDefault", arg0) +} diff --git a/pkg/config/config.go b/pkg/config/config.go index 35186c569e..7a073f4791 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -30,7 +30,10 @@ var format = logging.MustStringFormatter( `%{color}%{time:15:04:05.000} [%{module}] %{level:.4s} : %{color:reset} %{message}`, ) -const cmdRoot = "fabric_sdk" +const ( + cmdRoot = "fabric_sdk" + defaultTimeout = time.Second * 5 +) // Config represents the configuration for the client type Config struct { @@ -133,6 +136,26 @@ func (c *Config) CAClientCertFile(org string) (string, error) { "$GOPATH", os.Getenv("GOPATH"), -1), nil } +// TimeoutOrDefault reads connection timeouts for the given connection type +func (c *Config) TimeoutOrDefault(conn apiconfig.ConnectionType) time.Duration { + var timeout time.Duration + switch conn { + case apiconfig.Endorser: + timeout = myViper.GetDuration("connection.timeout.peer.endorser") + case apiconfig.EventHub: + timeout = myViper.GetDuration("connection.timeout.peer.eventhub") + case apiconfig.EventReg: + timeout = myViper.GetDuration("connection.timeout.peer.eventreg") + case apiconfig.Orderer: + timeout = myViper.GetDuration("connection.timeout.orderer") + } + if timeout == 0 { + timeout = defaultTimeout + } + + return timeout +} + // MspID returns the MSP ID for the requested organization func (c *Config) MspID(org string) (string, error) { config, err := c.NetworkConfig() diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 0a2eb9154c..62fba6a829 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -12,6 +12,7 @@ import ( "path/filepath" "strings" "testing" + "time" api "github.com/hyperledger/fabric-sdk-go/api/apiconfig" "github.com/spf13/viper" @@ -208,6 +209,36 @@ func TestTLSACAConfig(t *testing.T) { } } +func TestTimeouts(t *testing.T) { + myViper.Set("connection.timeout.peer.endorser", "2s") + myViper.Set("connection.timeout.peer.eventhub", "2m") + myViper.Set("connection.timeout.peer.eventreg", "2h") + myViper.Set("connection.timeout.orderer", "2ms") + + t1 := configImpl.TimeoutOrDefault(api.Endorser) + if t1 != time.Second*2 { + t.Fatalf("Timeout not read correctly. Got: %s", t1) + } + t2 := configImpl.TimeoutOrDefault(api.EventHub) + if t2 != time.Minute*2 { + t.Fatalf("Timeout not read correctly. Got: %s", t2) + } + t3 := configImpl.TimeoutOrDefault(api.EventReg) + if t3 != time.Hour*2 { + t.Fatalf("Timeout not read correctly. Got: %s", t3) + } + t4 := configImpl.TimeoutOrDefault(api.Orderer) + if t4 != time.Millisecond*2 { + t.Fatalf("Timeout not read correctly. Got: %s", t4) + } + // Test default + myViper.Set("connection.timeout.orderer", "") + t5 := configImpl.TimeoutOrDefault(api.Orderer) + if t5 != time.Second*5 { + t.Fatalf("Timeout not read correctly. Got: %s", t5) + } +} + func TestOrdererConfig(t *testing.T) { oConfig, err := configImpl.RandomOrdererConfig() diff --git a/pkg/fabric-ca-client/mocks/mockconfig.go b/pkg/fabric-ca-client/mocks/mockconfig.go index 211ccc0638..2a824e96e1 100644 --- a/pkg/fabric-ca-client/mocks/mockconfig.go +++ b/pkg/fabric-ca-client/mocks/mockconfig.go @@ -8,6 +8,7 @@ package mocks import ( "crypto/x509" + "time" "github.com/hyperledger/fabric-sdk-go/api/apiconfig" @@ -51,6 +52,11 @@ func (c *MockConfig) FabricClientViper() *viper.Viper { return nil } +//TimeoutOrDefault not implemented +func (c *MockConfig) TimeoutOrDefault(apiconfig.ConnectionType) time.Duration { + return 0 +} + // PeersConfig Retrieves the fabric peers from the config file provided func (c *MockConfig) PeersConfig(org string) ([]apiconfig.PeerConfig, error) { return nil, nil diff --git a/pkg/fabric-client/events/consumer/consumer.go b/pkg/fabric-client/events/consumer/consumer.go index dfc5d3eac4..b2cfb0b3f9 100644 --- a/pkg/fabric-client/events/consumer/consumer.go +++ b/pkg/fabric-client/events/consumer/consumer.go @@ -58,7 +58,7 @@ func NewEventsClient(client fab.FabricClient, peerAddress string, certificate st //newEventsClientConnectionWithAddress Returns a new grpc.ClientConn to the configured local PEER. func newEventsClientConnectionWithAddress(peerAddress string, certificate string, serverhostoverride string, config apiconfig.Config) (*grpc.ClientConn, error) { var opts []grpc.DialOption - opts = append(opts, grpc.WithTimeout(time.Second*3)) + opts = append(opts, grpc.WithTimeout(config.TimeoutOrDefault(apiconfig.EventHub))) if config.IsTLSEnabled() { tlsCaCertPool, err := config.TLSCACertPool(certificate) if err != nil { diff --git a/pkg/fabric-client/events/eventhub.go b/pkg/fabric-client/events/eventhub.go index 6913904308..88ce052495 100644 --- a/pkg/fabric-client/events/eventhub.go +++ b/pkg/fabric-client/events/eventhub.go @@ -16,6 +16,7 @@ import ( "time" "github.com/golang/protobuf/proto" + "github.com/hyperledger/fabric-sdk-go/api/apiconfig" fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient" "github.com/hyperledger/fabric-sdk-go/api/apitxn" consumer "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/events/consumer" @@ -245,7 +246,9 @@ func (eventHub *EventHub) Connect() error { } if eventHub.grpcClient == nil { - eventsClient, _ := eventHub.eventsClientFactory.newEventsClient(eventHub.client, eventHub.peerAddr, eventHub.peerTLSCertificate, eventHub.peerTLSServerHostOverride, 5, eventHub) + eventsClient, _ := eventHub.eventsClientFactory.newEventsClient(eventHub.client, + eventHub.peerAddr, eventHub.peerTLSCertificate, eventHub.peerTLSServerHostOverride, + eventHub.client.Config().TimeoutOrDefault(apiconfig.EventReg), eventHub) eventHub.grpcClient = eventsClient } diff --git a/pkg/fabric-client/mocks/mockconfig.go b/pkg/fabric-client/mocks/mockconfig.go index 5b0f9da4e8..f23058da26 100644 --- a/pkg/fabric-client/mocks/mockconfig.go +++ b/pkg/fabric-client/mocks/mockconfig.go @@ -8,6 +8,7 @@ package mocks import ( "crypto/x509" + "time" config "github.com/hyperledger/fabric-sdk-go/api/apiconfig" @@ -53,6 +54,11 @@ func (c *MockConfig) CAClientCertFile(org string) (string, error) { return "", nil } +//TimeoutOrDefault not implemented +func (c *MockConfig) TimeoutOrDefault(config.ConnectionType) time.Duration { + return 0 +} + // FabricClientViper returns the internal viper instance used by the // SDK to read configuration options func (c *MockConfig) FabricClientViper() *viper.Viper { diff --git a/pkg/fabric-client/orderer/orderer.go b/pkg/fabric-client/orderer/orderer.go index e135e4f392..34b43045c4 100644 --- a/pkg/fabric-client/orderer/orderer.go +++ b/pkg/fabric-client/orderer/orderer.go @@ -8,9 +8,8 @@ package orderer import ( "fmt" - "time" - config "github.com/hyperledger/fabric-sdk-go/api/apiconfig" + "github.com/hyperledger/fabric-sdk-go/api/apiconfig" fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient" "google.golang.org/grpc/credentials" @@ -30,9 +29,9 @@ type Orderer struct { } // NewOrderer Returns a Orderer instance -func NewOrderer(url string, certificate string, serverHostOverride string, config config.Config) (*Orderer, error) { +func NewOrderer(url string, certificate string, serverHostOverride string, config apiconfig.Config) (*Orderer, error) { var opts []grpc.DialOption - opts = append(opts, grpc.WithTimeout(time.Second*3)) + opts = append(opts, grpc.WithTimeout(config.TimeoutOrDefault(apiconfig.Orderer))) if config.IsTLSEnabled() { tlsCaCertPool, err := config.TLSCACertPool(certificate) if err != nil { diff --git a/pkg/fabric-client/peer/peer.go b/pkg/fabric-client/peer/peer.go index 93addf47c4..921db98feb 100644 --- a/pkg/fabric-client/peer/peer.go +++ b/pkg/fabric-client/peer/peer.go @@ -8,7 +8,6 @@ package peer import ( "encoding/pem" - "time" "github.com/hyperledger/fabric-sdk-go/api/apiconfig" fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient" @@ -19,7 +18,6 @@ import ( var logger = logging.MustGetLogger("fabric_sdk_go") const ( - connTimeout = time.Second * 10 // TODO: should be configurable connBlocking = true ) @@ -40,7 +38,7 @@ type Peer struct { // serverNameOverride is passed to NewClientTLSFromCert in grpc/credentials. func NewPeerTLSFromCert(url string, certificate string, serverHostOverride string, config apiconfig.Config) (*Peer, error) { // TODO: config is declaring TLS but cert & serverHostOverride is being passed-in... - conn, err := newPeerEndorser(url, certificate, serverHostOverride, connTimeout, connBlocking, config) + conn, err := newPeerEndorser(url, certificate, serverHostOverride, connBlocking, config) if err != nil { return nil, err } @@ -51,7 +49,7 @@ func NewPeerTLSFromCert(url string, certificate string, serverHostOverride strin // NewPeer constructs a Peer given its endpoint configuration settings. // url is the URL with format of "host:port". func NewPeer(url string, config apiconfig.Config) (*Peer, error) { - conn, err := newPeerEndorser(url, "", "", connTimeout, connBlocking, config) + conn, err := newPeerEndorser(url, "", "", connBlocking, config) if err != nil { return nil, err } diff --git a/pkg/fabric-client/peer/peer_test.go b/pkg/fabric-client/peer/peer_test.go index 07ae0f1a1c..251ee5fcc6 100644 --- a/pkg/fabric-client/peer/peer_test.go +++ b/pkg/fabric-client/peer/peer_test.go @@ -12,8 +12,10 @@ import ( "io/ioutil" "reflect" "testing" + "time" "github.com/golang/mock/gomock" + "github.com/hyperledger/fabric-sdk-go/api/apiconfig" "github.com/hyperledger/fabric-sdk-go/api/apiconfig/mocks" fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient" "github.com/hyperledger/fabric-sdk-go/api/apitxn" @@ -26,6 +28,7 @@ func TestNewPeerWithCertNoTLS(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) url := "http://example.com" p, err := NewPeer("http://example.com", config) @@ -49,6 +52,7 @@ func TestNewPeerTLSFromCert(t *testing.T) { config.EXPECT().IsTLSEnabled().Return(true) config.EXPECT().TLSCACertPool("cert").Return(certPool, nil) config.EXPECT().TLSCACertPool("").Return(certPool, nil) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) url := "0.0.0.0:1234" // TODO - test actual parameters and test server name override @@ -80,6 +84,7 @@ func TestNewPeerTLSFromCertBad(t *testing.T) { config.EXPECT().IsTLSEnabled().Return(true) config.EXPECT().TLSCACertPool("").Return(x509.NewCertPool(), nil) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) url := "0.0.0.0:1234" _, err := NewPeerTLSFromCert(url, "", "", config) @@ -95,6 +100,7 @@ func TestEnrollmentCert(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer, err := NewPeer(peer1URL, config) if err != nil { @@ -125,6 +131,7 @@ func TestRoles(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer, err := NewPeer(peer1URL, config) if err != nil { @@ -151,6 +158,7 @@ func TestNames(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer, err := NewPeer(peer1URL, config) if err != nil { @@ -174,6 +182,7 @@ func TestMSPIDs(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer, err := NewPeer(peer1URL, config) if err != nil { @@ -212,6 +221,7 @@ func TestPlaceholders(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer, err := NewPeer(peer1URL, config) if err != nil { @@ -239,6 +249,7 @@ func TestPeersToTxnProcessors(t *testing.T) { defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer1, err := NewPeer(peer1URL, config) if err != nil { @@ -246,6 +257,7 @@ func TestPeersToTxnProcessors(t *testing.T) { } config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) peer2, err := NewPeer(peer2URL, config) if err != nil { t.Fatalf("Failed to create NewPeer error(%v)", err) diff --git a/pkg/fabric-client/peer/peerendorser.go b/pkg/fabric-client/peer/peerendorser.go index 8298a12596..508ace9c5b 100644 --- a/pkg/fabric-client/peer/peerendorser.go +++ b/pkg/fabric-client/peer/peerendorser.go @@ -9,7 +9,6 @@ package peer import ( "context" "fmt" - "time" "github.com/hyperledger/fabric-sdk-go/api/apiconfig" "github.com/hyperledger/fabric-sdk-go/api/apitxn" @@ -31,15 +30,17 @@ type TransactionProposalError struct { Err error } -func newPeerEndorser(target string, certificate string, serverHostOverride string, dialTimeout time.Duration, dialBlocking bool, config apiconfig.Config) (peerEndorser, error) { +func newPeerEndorser(target string, certificate string, serverHostOverride string, + dialBlocking bool, config apiconfig.Config) ( + peerEndorser, error) { if len(target) == 0 { return peerEndorser{}, fmt.Errorf("Target is required") } // Construct dialer options for the connection var opts []grpc.DialOption - opts = append(opts, grpc.WithTimeout(dialTimeout)) // TODO: should be configurable - if dialBlocking { // TODO: configurable? + opts = append(opts, grpc.WithTimeout(config.TimeoutOrDefault(apiconfig.Endorser))) + if dialBlocking { // TODO: configurable? opts = append(opts, grpc.WithBlock()) } diff --git a/pkg/fabric-client/peer/peerendorser_test.go b/pkg/fabric-client/peer/peerendorser_test.go index f3df3e9bc4..4aa215c08b 100644 --- a/pkg/fabric-client/peer/peerendorser_test.go +++ b/pkg/fabric-client/peer/peerendorser_test.go @@ -17,6 +17,7 @@ import ( "google.golang.org/grpc" "github.com/golang/mock/gomock" + "github.com/hyperledger/fabric-sdk-go/api/apiconfig" "github.com/hyperledger/fabric-sdk-go/api/apiconfig/mocks" "github.com/hyperledger/fabric-sdk-go/api/apitxn" "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/mocks" @@ -44,8 +45,9 @@ func TestNewPeerEndorserTLS(t *testing.T) { config.EXPECT().IsTLSEnabled().Return(true) config.EXPECT().TLSCACertPool("cert").Return(certPool, nil) config.EXPECT().TLSCACertPool("").Return(certPool, nil) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - conn, err := newPeerEndorser(url, "cert", "", connTimeout, true, config) + conn, err := newPeerEndorser(url, "cert", "", true, config) if err != nil { t.Fatalf("Peer conn should be constructed") } @@ -73,8 +75,9 @@ func TestNewPeerEndorserTLSBadPool(t *testing.T) { config.EXPECT().IsTLSEnabled().Return(true) config.EXPECT().TLSCACertPool("").Return(certPool, nil) config.EXPECT().TLSCACertPool("cert").Return(certPool, fmt.Errorf("ohoh")) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - _, err := newPeerEndorser(url, "cert", "", connTimeout, true, config) + _, err := newPeerEndorser(url, "cert", "", true, config) if err == nil { t.Fatalf("Peer conn construction should have failed") } @@ -89,8 +92,9 @@ func TestNewPeerEndorserNoTLS(t *testing.T) { url := "0.0.0.0:1234" config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - conn, err := newPeerEndorser(url, "", "", connTimeout, true, config) + conn, err := newPeerEndorser(url, "", "", true, config) if err != nil { t.Fatalf("Peer conn should be constructed") } @@ -119,8 +123,9 @@ func TestNewPeerEndorserBlocking(t *testing.T) { url := "0.0.0.0:1234" config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - conn, err := newPeerEndorser(url, "", "", connTimeout, true, config) + conn, err := newPeerEndorser(url, "", "", true, config) if err != nil { t.Fatalf("Peer conn should be constructed") } @@ -149,8 +154,9 @@ func TestNewPeerEndorserNonBlocking(t *testing.T) { url := "0.0.0.0:1234" config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - conn, err := newPeerEndorser(url, "", "", connTimeout, false, config) + conn, err := newPeerEndorser(url, "", "", false, config) if err != nil { t.Fatalf("Peer conn should be constructed") } @@ -173,7 +179,7 @@ func TestNewPeerEndorserBadParams(t *testing.T) { config := mock_apiconfig.NewMockConfig(mockCtrl) url := "" - _, err := newPeerEndorser(url, "", "", connTimeout, true, config) + _, err := newPeerEndorser(url, "", "", true, config) if err == nil { t.Fatalf("Peer conn should not be constructed - bad params") } @@ -189,8 +195,9 @@ func TestNewPeerEndorserTLSBad(t *testing.T) { url := "0.0.0.0:1234" config.EXPECT().IsTLSEnabled().Return(true) config.EXPECT().TLSCACertPool("").Return(x509.NewCertPool(), nil) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - _, err := newPeerEndorser(url, "", "", connTimeout, true, config) + _, err := newPeerEndorser(url, "", "", true, config) if err == nil { t.Fatalf("Peer conn should not be constructed - bad cert pool") } @@ -199,7 +206,7 @@ func TestNewPeerEndorserTLSBad(t *testing.T) { // TestProcessProposalBadDial validates that a down // endorser fails gracefully. func TestProcessProposalBadDial(t *testing.T) { - _, err := testProcessProposal(t, testAddress, time.Millisecond*10) + _, err := testProcessProposal(t, testAddress) if err == nil { t.Fatalf("Process proposal should have failed") } @@ -212,20 +219,21 @@ func TestProcessProposalGoodDial(t *testing.T) { defer grpcServer.Stop() _, addr := startEndorserServer(t, grpcServer) - _, err := testProcessProposal(t, addr, connTimeout) + _, err := testProcessProposal(t, addr) if err != nil { t.Fatalf("Process proposal failed (%v)", err) } } -func testProcessProposal(t *testing.T, url string, to time.Duration) (apitxn.TransactionProposalResult, error) { +func testProcessProposal(t *testing.T, url string) (apitxn.TransactionProposalResult, error) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() config := mock_apiconfig.NewMockConfig(mockCtrl) config.EXPECT().IsTLSEnabled().Return(false) + config.EXPECT().TimeoutOrDefault(apiconfig.Endorser).Return(time.Second * 5) - conn, err := newPeerEndorser(url, "", "", to, true, config) + conn, err := newPeerEndorser(url, "", "", true, config) if err != nil { t.Fatalf("Peer conn construction error (%v)", err) } diff --git a/test/fixtures/config/config_test.yaml b/test/fixtures/config/config_test.yaml index eecb2d48b0..0b6af2515f 100755 --- a/test/fixtures/config/config_test.yaml +++ b/test/fixtures/config/config_test.yaml @@ -25,6 +25,14 @@ client: cryptoconfig: path: "$GOPATH/src/github.com/hyperledger/fabric-sdk-go/test/fixtures/channel/crypto-config" + connection: + timeout: + peer: + endorser: 3s + eventHub: 3s + eventReg: 3s + orderer: 3s + # network provides a static definition of a Hyperledger Fabric network network: # list of ordering service nodes