Skip to content

Commit

Permalink
Resolve feedbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
and1truong committed Mar 1, 2024
1 parent d9dcc72 commit cf03862
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions internal/resolver/dns/dns_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1242,13 +1242,11 @@ func (s) TestResolveTimeout(t *testing.T) {
// Define a testNetResolver with lookupHostCh, an unbuffered channel,
// so we can block the resolver until reaching timeout.
tr := &testNetResolver{
lookupHostCh: testutils.NewChannel(),
lookupHostCh: testutils.NewChannelWithSize(0),
hostLookupTable: map[string][]string{target: {"1.2.3.4"}},
}
overrideNetResolver(t, tr)

// block testNetResolver.testNetResolver until timeout
_ = tr.lookupHostCh.SendContext(ctx, nil)
_, _, errCh := buildResolverWithTestClientConn(t, target)
select {
case <-ctx.Done():
Expand Down
2 changes: 1 addition & 1 deletion internal/resolver/dns/fake_net_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type testNetResolver struct {

func (tr *testNetResolver) LookupHost(ctx context.Context, host string) ([]string, error) {
if tr.lookupHostCh != nil {
if err := tr.lookupHostCh.SendContext(ctx, nil); nil != err {
if err := tr.lookupHostCh.SendContext(ctx, nil); err != nil {
return nil, err
}
}
Expand Down

0 comments on commit cf03862

Please sign in to comment.