Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deeepsource errors #2299

Merged
merged 5 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions internal/client/v1/client/discoverer/discover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ func Test_client_GetReadClient(t *testing.T) {
client: &mockClient,
readClient: &mockReadClient,
readReplicaReplicas: 1,
roundRobin: counter,
//nolint: govet,copylocks
//skipcq: VET-V0008
roundRobin: counter,
},
want: &mockReadClient,
}
Expand All @@ -80,7 +82,9 @@ func Test_client_GetReadClient(t *testing.T) {
client: &mockClient,
readClient: &mockReadClient,
readReplicaReplicas: 1,
roundRobin: counter,
//nolint: govet,copylocks
//skipcq: VET-V0008
roundRobin: counter,
},
want: &mockClient,
}
Expand All @@ -94,20 +98,28 @@ func Test_client_GetReadClient(t *testing.T) {
client: &mockClient,
readClient: &mockReadClient,
readReplicaReplicas: 3,
roundRobin: counter,
//nolint: govet,copylocks
//skipcq: VET-V0008
roundRobin: counter,
},
want: &mockClient,
}
}(),
}
//nolint: govet,copylocks
//skipcq: VET-V0008
for _, tc := range tests {
//nolint: govet,copylocks
//skipcq: VET-V0008
test := tc
t.Run(test.name, func(t *testing.T) {
c := &client{
client: test.fields.client,
readClient: test.fields.readClient,
readReplicaReplicas: test.fields.readReplicaReplicas,
roundRobin: test.fields.roundRobin,
//nolint: govet,copylocks
//skipcq: VET-V0008
roundRobin: test.fields.roundRobin,
}
got := c.GetReadClient()
if !reflect.DeepEqual(got, test.want) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gateway/lb/usecase/vald.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type run struct {
gateway service.Gateway
}

func discovererClient(cfg *config.Data, dopts []grpc.Option, aopts []grpc.Option, eg errgroup.Group) (discoverer.Client, error) {
func discovererClient(cfg *config.Data, dopts, aopts []grpc.Option, eg errgroup.Group) (discoverer.Client, error) {
var discovererOpts []discoverer.Option
discovererOpts = append(discovererOpts,
discoverer.WithAutoConnect(true),
Expand Down
10 changes: 5 additions & 5 deletions pkg/gateway/lb/usecase/vald_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/vdaas/vald/internal/client/v1/client/discoverer"
iconfig "github.com/vdaas/vald/internal/config"
"github.com/vdaas/vald/internal/net/grpc"
"github.com/vdaas/vald/internal/sync/errgroup"
"github.com/vdaas/vald/pkg/gateway/lb/config"

"github.com/vdaas/vald/internal/net/grpc"
)

func Test_discovererClient(t *testing.T) {
Expand Down Expand Up @@ -100,10 +99,11 @@ func Test_discovererClient(t *testing.T) {
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
test := tt
t.Run(test.name, func(t *testing.T) {
t.Parallel()
client, err := discovererClient(tt.cfg, tt.dopts, tt.aopts, errgroup.Get())
tt.assert(t, client, err)
client, err := discovererClient(test.cfg, test.dopts, test.aopts, errgroup.Get())
test.assert(t, client, err)
})
}
}
Expand Down
Loading