+ dnsfilter: more tests
This commit is contained in:
parent
efaaeb58eb
commit
25da23497a
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/bluele/gcache"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
|
@ -572,3 +573,17 @@ func BenchmarkSafeSearchParallel(b *testing.B) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestDnsfilterDialCache(t *testing.T) {
|
||||
d := Dnsfilter{}
|
||||
dialCache = gcache.New(1).LRU().Expiration(30 * time.Minute).Build()
|
||||
|
||||
d.shouldBeInDialCache("hostname")
|
||||
if searchInDialCache("hostname") != "" {
|
||||
t.Errorf("searchInDialCache")
|
||||
}
|
||||
addToDialCache("hostname", "1.1.1.1")
|
||||
if searchInDialCache("hostname") != "1.1.1.1" {
|
||||
t.Errorf("searchInDialCache")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue