Skip to content

Commit a0ce76b

Browse files
committed
Resolve feedbacks.
1 parent d9dcc72 commit a0ce76b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

internal/resolver/dns/dns_resolver_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ func overrideResolveTimeoutDuration(t *testing.T, dur time.Duration) {
12251225
t.Cleanup(func() { dnspublic.SetResolvingTimeout(origDur) })
12261226
}
12271227

1228-
// Test verifies that when the DNS resolver gets timeout error when net.Resolver
1228+
// Test verifies that the DNS resolver gets timeout error when net.Resolver
12291229
// takes too long to resolve a target.
12301230
func (s) TestResolveTimeout(t *testing.T) {
12311231
// Set DNS resolving timeout duration to 7ms
@@ -1242,13 +1242,11 @@ func (s) TestResolveTimeout(t *testing.T) {
12421242
// Define a testNetResolver with lookupHostCh, an unbuffered channel,
12431243
// so we can block the resolver until reaching timeout.
12441244
tr := &testNetResolver{
1245-
lookupHostCh: testutils.NewChannel(),
1245+
lookupHostCh: testutils.NewChannelWithSize(0),
12461246
hostLookupTable: map[string][]string{target: {"1.2.3.4"}},
12471247
}
12481248
overrideNetResolver(t, tr)
12491249

1250-
// block testNetResolver.testNetResolver until timeout
1251-
_ = tr.lookupHostCh.SendContext(ctx, nil)
12521250
_, _, errCh := buildResolverWithTestClientConn(t, target)
12531251
select {
12541252
case <-ctx.Done():

internal/resolver/dns/fake_net_resolver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type testNetResolver struct {
4141

4242
func (tr *testNetResolver) LookupHost(ctx context.Context, host string) ([]string, error) {
4343
if tr.lookupHostCh != nil {
44-
if err := tr.lookupHostCh.SendContext(ctx, nil); nil != err {
44+
if err := tr.lookupHostCh.SendContext(ctx, nil); err != nil {
4545
return nil, err
4646
}
4747
}

0 commit comments

Comments
 (0)