From 6f0481965a8a67b0197f5b0c094b51ed5ff01da1 Mon Sep 17 00:00:00 2001 From: ssd04 Date: Mon, 20 May 2024 16:57:48 +0300 Subject: [PATCH] rename mock file --- service/hyperOutportBlock/blockService_test.go | 8 ++++---- ...erStreamStub.go => grpcServerStreamMock.go} | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) rename testscommon/{grpcServerStreamStub.go => grpcServerStreamMock.go} (69%) diff --git a/service/hyperOutportBlock/blockService_test.go b/service/hyperOutportBlock/blockService_test.go index eff411c..ed230e3 100644 --- a/service/hyperOutportBlock/blockService_test.go +++ b/service/hyperOutportBlock/blockService_test.go @@ -106,7 +106,7 @@ func TestService_Poll(t *testing.T) { require.Nil(t, err) nonce := uint64(10) - stream := &testscommon.GRPCServerStreamStub{} + stream := &testscommon.GRPCServerStreamMock{} pdDuration := durationpb.New(time.Duration(100) * time.Millisecond) wg := &sync.WaitGroup{} @@ -148,7 +148,7 @@ func TestService_Poll(t *testing.T) { expectedErr := errors.New("expected error") sendBlockCalled := uint32(0) - stream := &testscommon.GRPCServerStreamStub{ + stream := &testscommon.GRPCServerStreamMock{ SendCalled: func(block *data.HyperOutportBlock) error { if atomic.LoadUint32(&sendBlockCalled) <= 1 { atomic.AddUint32(&sendBlockCalled, 1) @@ -207,7 +207,7 @@ func TestService_HyperOutportBlocksStreamByHash(t *testing.T) { } wasCalled := uint32(0) - stream := &testscommon.GRPCServerStreamStub{ + stream := &testscommon.GRPCServerStreamMock{ SendCalled: func(block *data.HyperOutportBlock) error { atomic.AddUint32(&wasCalled, 1) return nil @@ -265,7 +265,7 @@ func TestService_HyperOutportBlocksStreamByNonce(t *testing.T) { } wasCalled := uint32(0) - stream := &testscommon.GRPCServerStreamStub{ + stream := &testscommon.GRPCServerStreamMock{ SendCalled: func(block *data.HyperOutportBlock) error { atomic.AddUint32(&wasCalled, 1) return nil diff --git a/testscommon/grpcServerStreamStub.go b/testscommon/grpcServerStreamMock.go similarity index 69% rename from testscommon/grpcServerStreamStub.go rename to testscommon/grpcServerStreamMock.go index debc874..2f0f8ce 100644 --- a/testscommon/grpcServerStreamStub.go +++ b/testscommon/grpcServerStreamMock.go @@ -7,8 +7,8 @@ import ( "google.golang.org/grpc/metadata" ) -// GRPCServerStreamStub - -type GRPCServerStreamStub struct { +// GRPCServerStreamMock - +type GRPCServerStreamMock struct { SetHeaderCalled func(_ metadata.MD) error SendHeaderCalled func(_ metadata.MD) error SetTrailerCalled func(_ metadata.MD) @@ -19,7 +19,7 @@ type GRPCServerStreamStub struct { } // Send - -func (g *GRPCServerStreamStub) Send(block *data.HyperOutportBlock) error { +func (g *GRPCServerStreamMock) Send(block *data.HyperOutportBlock) error { if g.SendCalled != nil { return g.SendCalled(block) } @@ -28,7 +28,7 @@ func (g *GRPCServerStreamStub) Send(block *data.HyperOutportBlock) error { } // SetHeader - -func (g *GRPCServerStreamStub) SetHeader(md metadata.MD) error { +func (g *GRPCServerStreamMock) SetHeader(md metadata.MD) error { if g.SetHeaderCalled != nil { return g.SetHeaderCalled(md) } @@ -37,7 +37,7 @@ func (g *GRPCServerStreamStub) SetHeader(md metadata.MD) error { } // SendHeader - -func (g *GRPCServerStreamStub) SendHeader(md metadata.MD) error { +func (g *GRPCServerStreamMock) SendHeader(md metadata.MD) error { if g.SendHeaderCalled != nil { return g.SendHeaderCalled(md) } @@ -46,14 +46,14 @@ func (g *GRPCServerStreamStub) SendHeader(md metadata.MD) error { } // SetTrailer - -func (g *GRPCServerStreamStub) SetTrailer(md metadata.MD) { +func (g *GRPCServerStreamMock) SetTrailer(md metadata.MD) { if g.SetTrailerCalled != nil { g.SetTrailerCalled(md) } } // Context - -func (g *GRPCServerStreamStub) Context() context.Context { +func (g *GRPCServerStreamMock) Context() context.Context { if g.ContextCalled != nil { return g.ContextCalled() } @@ -62,7 +62,7 @@ func (g *GRPCServerStreamStub) Context() context.Context { } // SendMsg - -func (g *GRPCServerStreamStub) SendMsg(m any) error { +func (g *GRPCServerStreamMock) SendMsg(m any) error { if g.SendMsgCalled != nil { return g.SendMsgCalled(m) } @@ -71,7 +71,7 @@ func (g *GRPCServerStreamStub) SendMsg(m any) error { } // RecvMsg - -func (g *GRPCServerStreamStub) RecvMsg(m any) error { +func (g *GRPCServerStreamMock) RecvMsg(m any) error { if g.RecvMsgCalled != nil { return g.RecvMsgCalled(m) }