diff --git a/e2e/bad_test.go b/e2e/bad_test.go index dd9adf30..2885ca09 100644 --- a/e2e/bad_test.go +++ b/e2e/bad_test.go @@ -165,7 +165,7 @@ var _ = Describe("Mock test for error input", func() { cmd := exec.Command(tapeBin, "-c", config.Name(), "-n", "500") tapeSession, err = gexec.Start(cmd, nil, nil) Expect(err).NotTo(HaveOccurred()) - Eventually(tapeSession.Err).Should(Say("error connecting to invalid_addr")) + Eventually(tapeSession.Err).Should(Say("rpc error:")) }) }) }) diff --git a/go.mod b/go.mod index a9a33d2e..579c309c 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/uber/jaeger-client-go v2.30.0+incompatible golang.org/x/time v0.5.0 - google.golang.org/grpc v1.62.1 + google.golang.org/grpc v1.63.0 google.golang.org/protobuf v1.33.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/yaml.v2 v2.4.0 @@ -59,7 +59,7 @@ require ( golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index 56df8d50..0a291ad8 100644 --- a/go.sum +++ b/go.sum @@ -289,18 +289,18 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.63.0 h1:WjKe+dnvABXyPJMD7KDNLxtoGk5tgk+YFWN6cBWjZE8= +google.golang.org/grpc v1.63.0/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= diff --git a/internal/fabric/core/comm/client.go b/internal/fabric/core/comm/client.go index 69378636..e073e002 100644 --- a/internal/fabric/core/comm/client.go +++ b/internal/fabric/core/comm/client.go @@ -7,7 +7,6 @@ SPDX-License-Identifier: Apache-2.0 package comm import ( - "context" "crypto/tls" "crypto/x509" "time" @@ -26,8 +25,6 @@ type GRPCClient struct { tlsConfig *tls.Config // Options for setting up new connections dialOpts []grpc.DialOption - // Duration for which to block while established a new connection - timeout time.Duration // Maximum message size the client can receive maxRecvMsgSize int // Maximum message size the client can send @@ -49,7 +46,6 @@ func NewGRPCClient(config ClientConfig) (*GRPCClient, error) { kap := keepalive.ClientParameters{ Time: config.KaOpts.ClientInterval, - Timeout: config.KaOpts.ClientTimeout, PermitWithoutStream: true, } // set keepalive @@ -59,7 +55,6 @@ func NewGRPCClient(config ClientConfig) (*GRPCClient, error) { client.dialOpts = append(client.dialOpts, grpc.WithBlock()) client.dialOpts = append(client.dialOpts, grpc.FailOnNonTempDialError(true)) } - client.timeout = config.Timeout // set send/recv message size to package defaults client.maxRecvMsgSize = MaxRecvMsgSize client.maxSendMsgSize = MaxSendMsgSize @@ -153,9 +148,7 @@ func (client *GRPCClient) NewConnection(address string, tlsOptions ...TLSOption) grpc.WithStreamInterceptor(grpc_opentracing.StreamClientInterceptor(opts...)), ) - ctx, cancel := context.WithTimeout(context.Background(), client.timeout) - defer cancel() - conn, err := grpc.DialContext(ctx, address, dialOpts...) + conn, err := grpc.NewClient(address, dialOpts...) if err != nil { return nil, errors.WithMessage(errors.WithStack(err), "failed to create new connection") diff --git a/pkg/infra/basic/client.go b/pkg/infra/basic/client.go index 35390ef5..8db882e2 100644 --- a/pkg/infra/basic/client.go +++ b/pkg/infra/basic/client.go @@ -3,7 +3,6 @@ package basic import ( "context" "crypto/tls" - "time" "github.com/hyperledger-twgc/tape/internal/fabric/core/comm" @@ -20,7 +19,6 @@ func CreateGRPCClient(node Node) (*comm.GRPCClient, error) { certs = append(certs, node.TLSCACertByte) } config := comm.ClientConfig{} - config.Timeout = 5 * time.Second config.SecOpts = comm.SecureOptions{ UseTLS: false, RequireClientCert: false, diff --git a/pkg/infra/basic/client_test.go b/pkg/infra/basic/client_test.go index f05e5ffc..fa7c1249 100644 --- a/pkg/infra/basic/client_test.go +++ b/pkg/infra/basic/client_test.go @@ -15,32 +15,6 @@ import ( ) var _ = Describe("Client", func() { - - Context("Client Error handling", func() { - dummy := basic.Node{ - Addr: "invalid_addr", - } - logger := log.New() - - It("captures error from endorser", func() { - _, err := basic.CreateEndorserClient(dummy, logger) - Expect(err).Should(MatchError(ContainSubstring("error connecting to invalid_addr"))) - }) - It("captures error from broadcaster", func() { - _, err := basic.CreateBroadcastClient(context.Background(), dummy, logger) - Expect(err).Should(MatchError(ContainSubstring("error connecting to invalid_addr"))) - }) - It("captures error from DeliverFilter", func() { - _, err := basic.CreateDeliverFilteredClient(context.Background(), dummy, logger) - Expect(err).Should(MatchError(ContainSubstring("error connecting to invalid_addr"))) - }) - - It("captures error from CreateDeliverClient", func() { - _, err := basic.CreateDeliverClient(dummy) - Expect(err).Should(MatchError(ContainSubstring("failed to create new connection"))) - }) - }) - Context("connect with mock peer", func() { var mockserver *mock.Server var peerNode, OrdererNode basic.Node diff --git a/pkg/infra/trafficGenerator/proposer_test.go b/pkg/infra/trafficGenerator/proposer_test.go index 30864027..3c095776 100644 --- a/pkg/infra/trafficGenerator/proposer_test.go +++ b/pkg/infra/trafficGenerator/proposer_test.go @@ -41,15 +41,6 @@ var _ = Describe("Proposer", func() { Expect(Proposer.Addr).To(Equal(addr)) Expect(err).NotTo(HaveOccurred()) }) - - It("handle error ", func() { - dummy := basic.Node{ - Addr: "invalid_addr", - } - rule := "1 == 1" - _, err := trafficGenerator.CreateProposer(dummy, logger, rule) - Expect(err).Should(MatchError(ContainSubstring("error connecting to invalid_addr"))) - }) }) Context("CreateBroadcasters", func() { @@ -67,7 +58,7 @@ var _ = Describe("Proposer", func() { Addr: "invalid_addr", } _, err := trafficGenerator.CreateBroadcaster(context.Background(), dummy, logger) - Expect(err).Should(MatchError(ContainSubstring("error connecting to invalid_addr"))) + Expect(err).Should(MatchError(ContainSubstring("rpc error: code"))) }) })