mirror of
https://github.com/coredns/coredns.git
synced 2025-11-24 12:44:05 -05:00
refactor: use reflect.TypeFor (#7696)
This commit is contained in:
@@ -78,16 +78,16 @@ func TestTtlRewrite(t *testing.T) {
|
||||
args []string
|
||||
expectedType reflect.Type
|
||||
}{
|
||||
{[]string{"stop", "ttl", "srv1.coredns.rocks", "1"}, reflect.TypeOf(&exactTTLRule{})},
|
||||
{[]string{"stop", "ttl", "exact", "srv15.coredns.rocks", "15"}, reflect.TypeOf(&exactTTLRule{})},
|
||||
{[]string{"stop", "ttl", "prefix", "srv30", "30"}, reflect.TypeOf(&prefixTTLRule{})},
|
||||
{[]string{"stop", "ttl", "suffix", "45.coredns.rocks", "45"}, reflect.TypeOf(&suffixTTLRule{})},
|
||||
{[]string{"stop", "ttl", "substring", "rv50", "50"}, reflect.TypeOf(&substringTTLRule{})},
|
||||
{[]string{"stop", "ttl", "regex", `(srv10)\.(coredns)\.(rocks)`, "10"}, reflect.TypeOf(®exTTLRule{})},
|
||||
{[]string{"stop", "ttl", "regex", `(srv20)\.(coredns)\.(rocks)`, "20"}, reflect.TypeOf(®exTTLRule{})},
|
||||
{[]string{"stop", "ttl", "range.example.com.", "30-300"}, reflect.TypeOf(&exactTTLRule{})},
|
||||
{[]string{"stop", "ttl", "ceil.example.com.", "-11"}, reflect.TypeOf(&exactTTLRule{})},
|
||||
{[]string{"stop", "ttl", "floor.example.com.", "5-"}, reflect.TypeOf(&exactTTLRule{})},
|
||||
{[]string{"stop", "ttl", "srv1.coredns.rocks", "1"}, reflect.TypeFor[*exactTTLRule]()},
|
||||
{[]string{"stop", "ttl", "exact", "srv15.coredns.rocks", "15"}, reflect.TypeFor[*exactTTLRule]()},
|
||||
{[]string{"stop", "ttl", "prefix", "srv30", "30"}, reflect.TypeFor[*prefixTTLRule]()},
|
||||
{[]string{"stop", "ttl", "suffix", "45.coredns.rocks", "45"}, reflect.TypeFor[*suffixTTLRule]()},
|
||||
{[]string{"stop", "ttl", "substring", "rv50", "50"}, reflect.TypeFor[*substringTTLRule]()},
|
||||
{[]string{"stop", "ttl", "regex", `(srv10)\.(coredns)\.(rocks)`, "10"}, reflect.TypeFor[*regexTTLRule]()},
|
||||
{[]string{"stop", "ttl", "regex", `(srv20)\.(coredns)\.(rocks)`, "20"}, reflect.TypeFor[*regexTTLRule]()},
|
||||
{[]string{"stop", "ttl", "range.example.com.", "30-300"}, reflect.TypeFor[*exactTTLRule]()},
|
||||
{[]string{"stop", "ttl", "ceil.example.com.", "-11"}, reflect.TypeFor[*exactTTLRule]()},
|
||||
{[]string{"stop", "ttl", "floor.example.com.", "5-"}, reflect.TypeFor[*exactTTLRule]()},
|
||||
}
|
||||
for i, r := range ruleset {
|
||||
rule, err := newRule(r.args...)
|
||||
|
||||
Reference in New Issue
Block a user