mirror of
https://github.com/coredns/coredns.git
synced 2026-02-06 15:33:10 -05:00
refactor(cache): modernize with generics (#7842)
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"github.com/coredns/coredns/plugin/pkg/cache"
|
||||
"github.com/coredns/coredns/plugin/test"
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func TestCacheSet(t *testing.T) {
|
||||
@@ -20,7 +22,7 @@ func TestCacheSet(t *testing.T) {
|
||||
t.Fatalf("Failed to parse key: %v\n", err)
|
||||
}
|
||||
|
||||
c := cache.New(defaultCap)
|
||||
c := cache.New[[]dns.RR](defaultCap)
|
||||
m := testMsg()
|
||||
state := request.Request{Req: m, Zone: "miek.nl."}
|
||||
k := hash(m.Answer) // calculate *before* we add the sig
|
||||
@@ -44,7 +46,7 @@ func TestCacheNotValidExpired(t *testing.T) {
|
||||
t.Fatalf("Failed to parse key: %v\n", err)
|
||||
}
|
||||
|
||||
c := cache.New(defaultCap)
|
||||
c := cache.New[[]dns.RR](defaultCap)
|
||||
m := testMsg()
|
||||
state := request.Request{Req: m, Zone: "miek.nl."}
|
||||
k := hash(m.Answer) // calculate *before* we add the sig
|
||||
@@ -68,7 +70,7 @@ func TestCacheNotValidYet(t *testing.T) {
|
||||
t.Fatalf("Failed to parse key: %v\n", err)
|
||||
}
|
||||
|
||||
c := cache.New(defaultCap)
|
||||
c := cache.New[[]dns.RR](defaultCap)
|
||||
m := testMsg()
|
||||
state := request.Request{Req: m, Zone: "miek.nl."}
|
||||
k := hash(m.Answer) // calculate *before* we add the sig
|
||||
|
||||
Reference in New Issue
Block a user