mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
Test and fix notify
More tests and add RemoteAddr to State, prolly LocalAddr will be useful as well. Fixed and tested IsNotify method.
This commit is contained in:
@@ -17,6 +17,20 @@ func TestStateDo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStateRemote(t *testing.T) {
|
||||
st := testState()
|
||||
if st.IP() != "10.240.0.1" {
|
||||
t.Fatalf("wrong IP from state")
|
||||
}
|
||||
p, err := st.Port()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get Port from state")
|
||||
}
|
||||
if p != "40212" {
|
||||
t.Fatalf("wrong port from state")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkStateDo(b *testing.B) {
|
||||
st := testState()
|
||||
|
||||
@@ -37,7 +51,6 @@ func testState() State {
|
||||
m := new(dns.Msg)
|
||||
m.SetQuestion("example.com.", dns.TypeA)
|
||||
m.SetEdns0(4097, true)
|
||||
|
||||
return State{W: &coretest.ResponseWriter{}, Req: m}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user