Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yashash H L <[email protected]>
  • Loading branch information
yhl25 committed Sep 13, 2024
1 parent 568c60d commit 4910018
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/mapper/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestMapServer_GracefulShutdown(t *testing.T) {
time.Sleep(10 * time.Millisecond)

// create a client
conn, err := grpc.Dial(
conn, err := grpc.NewClient(
"unix://"+socketFile.Name(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
Expand Down
13 changes: 13 additions & 0 deletions pkg/sourcer/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/types/known/emptypb"
"google.golang.org/protobuf/types/known/timestamppb"

Expand Down Expand Up @@ -61,6 +62,10 @@ type ReadFnServerTest struct {
index int
}

func (t *ReadFnServerTest) SendHeader(metadata.MD) error {
return nil
}

func (t *ReadFnServerTest) Recv() (*sourcepb.ReadRequest, error) {
if t.index >= len(t.requests) {
return nil, io.EOF
Expand Down Expand Up @@ -96,6 +101,10 @@ type ReadFnServerErrTest struct {
grpc.ServerStream
}

func (te *ReadFnServerErrTest) SendHeader(metadata.MD) error {
return nil
}

func (te *ReadFnServerErrTest) Recv() (*sourcepb.ReadRequest, error) {
return nil, fmt.Errorf("recv error")
}
Expand Down Expand Up @@ -146,6 +155,10 @@ func NewAckFnServerTest(
}
}

func (a *AckFnServerTest) SendHeader(metadata.MD) error {
return nil
}

func (a *AckFnServerTest) SendAndClose(*sourcepb.AckResponse) error {
return nil
}
Expand Down

0 comments on commit 4910018

Please sign in to comment.