Skip to content

Commit

Permalink
fix: fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: chyezh <[email protected]>
  • Loading branch information
chyezh committed Jul 17, 2024
1 parent 70da7fe commit 3794d3a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions internal/streamingnode/client/handler/handler_client_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"time"

"go.uber.org/zap"

"github.com/cenkalti/backoff/v4"
"github.com/cockroachdb/errors"
"go.uber.org/zap"

"github.com/milvus-io/milvus/internal/proto/streamingpb"
"github.com/milvus-io/milvus/internal/streamingnode/client/handler/assignment"
"github.com/milvus-io/milvus/internal/streamingnode/client/handler/consumer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"go.uber.org/atomic"
"google.golang.org/grpc"

"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus/internal/mocks"
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
"github.com/milvus-io/milvus/pkg/util/merr"
)

func NewMockRootCoordClient(t *testing.T) *mocks.MockRootCoordClient {
Expand All @@ -27,9 +27,7 @@ func NewMockRootCoordClient(t *testing.T) *mocks.MockRootCoordClient {
}
c := counter.Add(uint64(atr.Count))
return &rootcoordpb.AllocTimestampResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
Status: merr.Success(),
Timestamp: c - uint64(atr.Count),
Count: atr.Count,
}, nil
Expand All @@ -42,11 +40,9 @@ func NewMockRootCoordClient(t *testing.T) *mocks.MockRootCoordClient {
}
c := counter.Add(uint64(atr.Count))
return &rootcoordpb.AllocIDResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
ID: int64(c - uint64(atr.Count)),
Count: atr.Count,
Status: merr.Success(),
ID: int64(c - uint64(atr.Count)),
Count: atr.Count,
}, nil
},
).Maybe()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package attributes
import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/milvus-io/milvus/internal/util/sessionutil"
"github.com/milvus-io/milvus/pkg/streaming/util/types"
"github.com/stretchr/testify/assert"
)

func TestAttributes(t *testing.T) {
Expand Down Expand Up @@ -38,6 +39,5 @@ func TestAttributes(t *testing.T) {

attr = new(Attributes)
attr = WithServerID(attr, 1)
serverID = GetServerID(attr)
assert.Equal(t, int64(1), *GetServerID(attr))
}
4 changes: 2 additions & 2 deletions internal/util/streamingutil/service/interceptor/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewStreamingServiceUnaryServerInterceptor() grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
resp, err := handler(ctx, req)
if err == nil {
return resp, err
return resp, nil
}
// Streaming Service Method should be overwrite the response error code.
if strings.HasPrefix(info.FullMethod, streamingpb.ServiceMethodPrefix) {
Expand All @@ -35,7 +35,7 @@ func NewStreamingServiceStreamServerInterceptor() grpc.StreamServerInterceptor {
return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
err := handler(srv, ss)
if err == nil {
return err
return nil
}

// Streaming Service Method should be overwrite the response error code.
Expand Down
2 changes: 1 addition & 1 deletion internal/util/streamingutil/service/resolver/builder.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package resolver

import (
"errors"
"time"

"github.com/cockroachdb/errors"
clientv3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap"
"google.golang.org/grpc/resolver"
Expand Down
7 changes: 4 additions & 3 deletions internal/util/streamingutil/service/resolver/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc/resolver"

"github.com/milvus-io/milvus/internal/mocks/google.golang.org/grpc/mock_resolver"
"github.com/milvus-io/milvus/internal/mocks/util/streamingutil/service/mock_discoverer"
"github.com/milvus-io/milvus/internal/util/streamingutil/service/discoverer"
"github.com/milvus-io/milvus/pkg/util/typeutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc/resolver"
)

func TestNewBuilder(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/util/streamingutil/service/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package resolver

import (
"context"
"errors"

"github.com/cockroachdb/errors"
"google.golang.org/grpc/resolver"

"github.com/milvus-io/milvus/internal/util/streamingutil/service/discoverer"
Expand Down

0 comments on commit 3794d3a

Please sign in to comment.