wip: migrate to mono-repo. SPN has already been moved to spn/
This commit is contained in:
46
service/resolver/rrcache_test.go
Normal file
46
service/resolver/rrcache_test.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package resolver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func TestCaching(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testDomain := "Mk35mMqOWEHXSMk11MYcbjLOjTE8PQvDiAVUxf4BvwtgR.example.com."
|
||||
testQuestion := "A"
|
||||
|
||||
testNameRecord := &NameRecord{
|
||||
Domain: testDomain,
|
||||
Question: testQuestion,
|
||||
Resolver: &ResolverInfo{
|
||||
Type: "dns",
|
||||
},
|
||||
}
|
||||
|
||||
err := testNameRecord.Save()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rrCache, err := GetRRCache(testDomain, dns.Type(dns.TypeA))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = rrCache.Save()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rrCache2, err := GetRRCache(testDomain, dns.Type(dns.TypeA))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if rrCache2.Domain != rrCache.Domain {
|
||||
t.Fatal("something very is wrong")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user