Files
coredns/plugin/errors/benchmark_test.go
Ville Vesilehto 39abf5aeba chore(lint): modernize Go (#7536)
Use modern Go constructs through the modernize analyzer from the
golang.org/x/tools package.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-10 13:08:27 -07:00

28 lines
449 B
Go

package errors
import (
"context"
"testing"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)
func BenchmarkServeDNS(b *testing.B) {
h := &errorHandler{}
h.Next = test.ErrorHandler()
r := new(dns.Msg)
r.SetQuestion("example.org.", dns.TypeA)
w := &test.ResponseWriter{}
ctx := context.TODO()
for b.Loop() {
_, err := h.ServeDNS(ctx, w, r)
if err != nil {
b.Errorf("ServeDNS returned error: %s", err)
}
}
}