Skip to content

Commit

Permalink
fix: cyclic import for testing
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Nov 8, 2023
1 parent 66976e9 commit 90cea88
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mock
package client

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package mock
package grpc

import (
"context"
Expand Down
17 changes: 9 additions & 8 deletions pkg/index/job/save/service/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (
"github.com/vdaas/vald/internal/net/grpc/codes"
"github.com/vdaas/vald/internal/net/grpc/status"
"github.com/vdaas/vald/internal/test/goleak"
"github.com/vdaas/vald/internal/test/mock"
clientmock "github.com/vdaas/vald/internal/test/mock/client"
grpcmock "github.com/vdaas/vald/internal/test/mock/grpc"
)

func Test_index_Start(t *testing.T) {
Expand Down Expand Up @@ -67,12 +68,12 @@ func Test_index_Start(t *testing.T) {
},

fields: fields{
client: &mock.DiscovererClientMock{
client: &clientmock.DiscovererClientMock{
GetAddrsFunc: func(_ context.Context) []string {
return addrs
},
GetClientFunc: func() grpc.Client {
return &mock.GRPCClientMock{
return &grpcmock.GRPCClientMock{
OrderedRangeConcurrentFunc: func(_ context.Context, _ []string, _ int,
_ func(_ context.Context, _ string, _ *grpc.ClientConn, _ ...grpc.CallOption) error,
) error {
Expand All @@ -94,12 +95,12 @@ func Test_index_Start(t *testing.T) {
ctx: context.Background(),
},
fields: fields{
client: &mock.DiscovererClientMock{
client: &clientmock.DiscovererClientMock{
GetAddrsFunc: func(_ context.Context) []string {
return addrs
},
GetClientFunc: func() grpc.Client {
return &mock.GRPCClientMock{
return &grpcmock.GRPCClientMock{
OrderedRangeConcurrentFunc: func(_ context.Context, _ []string, _ int,
_ func(_ context.Context, _ string, _ *grpc.ClientConn, _ ...grpc.CallOption) error,
) error {
Expand Down Expand Up @@ -129,12 +130,12 @@ func Test_index_Start(t *testing.T) {
},

fields: fields{
client: &mock.DiscovererClientMock{
client: &clientmock.DiscovererClientMock{
GetAddrsFunc: func(_ context.Context) []string {
return addrs
},
GetClientFunc: func() grpc.Client {
return &mock.GRPCClientMock{
return &grpcmock.GRPCClientMock{
OrderedRangeConcurrentFunc: func(_ context.Context, _ []string, _ int,
_ func(_ context.Context, _ string, _ *grpc.ClientConn, _ ...grpc.CallOption) error,
) error {
Expand Down Expand Up @@ -163,7 +164,7 @@ func Test_index_Start(t *testing.T) {
ctx: context.Background(),
},
fields: fields{
client: &mock.DiscovererClientMock{
client: &clientmock.DiscovererClientMock{
GetAddrsFunc: func(_ context.Context) []string {
// NOTE: This function returns nil, meaning that the targetAddrs stored in the field are invalid values.
return nil
Expand Down

0 comments on commit 90cea88

Please sign in to comment.