fix(forward): make dnstap FORWARDER_* describe the socket from CoreDNS to upstream (#8184)

Signed-off-by: Jaime Hablutzel <hablutzel1@gmail.com>
This commit is contained in:
Jaime Hablutzel
2026-07-01 23:04:04 -05:00
committed by GitHub
parent 6e7093cafb
commit 8d94712f99
5 changed files with 138 additions and 44 deletions

View File

@@ -36,7 +36,7 @@ func TestProxy(t *testing.T) {
rec := dnstest.NewRecorder(&test.ResponseWriter{})
req := request.Request{Req: m, W: rec}
resp, err := p.Connect(context.Background(), req, Options{PreferUDP: true})
resp, _, _, err := p.Connect(context.Background(), req, Options{PreferUDP: true})
if err != nil {
t.Errorf("Failed to connect to testdnsserver: %s", err)
}
@@ -67,7 +67,7 @@ func TestProxyTLSFail(t *testing.T) {
rec := dnstest.NewRecorder(&test.ResponseWriter{})
req := request.Request{Req: m, W: rec}
_, err := p.Connect(context.Background(), req, Options{})
_, _, _, err := p.Connect(context.Background(), req, Options{})
if err == nil {
t.Fatal("Expected *not* to receive reply, but got one")
}
@@ -121,7 +121,7 @@ func TestProtocolSelection(t *testing.T) {
Req: m,
}
resp, err := p.Connect(context.Background(), req, tc.opts)
resp, _, proto, err := p.Connect(context.Background(), req, tc.opts)
if err != nil {
t.Fatalf("Connect failed: %v", err)
}
@@ -133,6 +133,10 @@ func TestProtocolSelection(t *testing.T) {
if receivedProto != tc.expectedProto {
t.Errorf("Expected protocol %q, but server received %q", tc.expectedProto, receivedProto)
}
if proto != tc.expectedProto {
t.Errorf("Expected Connect to report proto %q, got %q", tc.expectedProto, proto)
}
})
}
}
@@ -214,7 +218,7 @@ func TestCoreDNSOverflow(t *testing.T) {
recorder := dnstest.NewRecorder(&test.ResponseWriter{})
request := request.Request{Req: queryMsg, W: recorder}
response, err := p.Connect(context.Background(), request, options)
response, _, _, err := p.Connect(context.Background(), request, options)
if err != nil {
t.Errorf("Failed to connect to testdnsserver: %s", err)
}