(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestResponse(t *testing.T) { |
| 43 | // Send query for example.org, get reply for example.net; should not be cached. |
| 44 | c := New() |
| 45 | c.Next = spoofHandler(false) |
| 46 | |
| 47 | req := new(dns.Msg) |
| 48 | req.SetQuestion("example.net.", dns.TypeA) |
| 49 | rec := dnstest.NewRecorder(&test.ResponseWriter{}) |
| 50 | |
| 51 | c.ServeDNS(context.TODO(), rec, req) |
| 52 | |
| 53 | if c.pcache.Len() != 0 { |
| 54 | t.Errorf("Cached %s, while reply had response set to %t", "example.net.", rec.Msg.Response) |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // spoofHandler is a fake plugin implementation which returns a single A records for example.org. The qname in the |
| 59 | // question section is set to example.NET (i.e. they *don't* match). |
nothing calls this directly
no test coverage detected
searching dependent graphs…