MCPcopy
hub / github.com/grpc/grpc-go / overrideTimeAfterFunc

Function overrideTimeAfterFunc

internal/resolver/dns/dns_resolver_test.go:80–86  ·  view source on GitHub ↗

Override the timer used by the DNS resolver to fire after a duration of d.

(t *testing.T, d time.Duration)

Source from the content-addressed store, hash-verified

78
79// Override the timer used by the DNS resolver to fire after a duration of d.
80func overrideTimeAfterFunc(t *testing.T, d time.Duration) {
81 origTimeAfter := dnsinternal.TimeAfterFunc
82 dnsinternal.TimeAfterFunc = func(time.Duration) <-chan time.Time {
83 return time.After(d)
84 }
85 t.Cleanup(func() { dnsinternal.TimeAfterFunc = origTimeAfter })
86}
87
88// Override the timer used by the DNS resolver as follows:
89// - use the durChan to read the duration that the resolver wants to wait for

Callers 7

TestDNSResolver_BasicMethod · 0.85
TestIPResolverMethod · 0.85
TestResolverBuildMethod · 0.85
TestTXTErrorMethod · 0.85
TestCustomAuthorityMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected