simplify dns.MockResolver, changing MockReq to just a string representing the request

similar to Authentic/Inauthentic
This commit is contained in:
Mechiel Lukkien
2023-10-12 16:07:25 +02:00
parent c095f3f39c
commit 7dce883097
10 changed files with 57 additions and 54 deletions

View File

@ -73,10 +73,10 @@ func TestGatherDestinations(t *testing.T) {
"danglingcname.example.": "absent.example.", // Points to missing name.
"temperror-cname.example.": "absent.example.",
},
Fail: map[dns.Mockreq]struct{}{
{Type: "mx", Name: "temperror-mx.example."}: {},
{Type: "host", Name: "temperror-a.example."}: {},
{Type: "cname", Name: "temperror-cname.example."}: {},
Fail: []string{
"mx temperror-mx.example.",
"host temperror-a.example.",
"cname temperror-cname.example.",
},
Inauthentic: []string{"cname cnameinauthentic.example."},
}
@ -154,9 +154,9 @@ func TestGatherIPs(t *testing.T) {
"danglingcname.example.": "absent.example.", // Points to missing name.
"temperror-cname.example.": "absent.example.",
},
Fail: map[dns.Mockreq]struct{}{
{Type: "host", Name: "temperror-a.example."}: {},
{Type: "cname", Name: "temperror-cname.example."}: {},
Fail: []string{
"host temperror-a.example.",
"cname temperror-cname.example.",
},
Inauthentic: []string{"cname cnameinauthentic.example."},
}
@ -241,8 +241,8 @@ func TestGatherTLSA(t *testing.T) {
"_25._tcp.cnameinauthentic.example.": "_25._tcp.host1.example.",
"_25._tcp.danglingcname.example.": "_25._tcp.absent.example.", // Points to missing name.
},
Fail: map[dns.Mockreq]struct{}{
{Type: "cname", Name: "_25._tcp.temperror-cname.example."}: {},
Fail: []string{
"cname _25._tcp.temperror-cname.example.",
},
Inauthentic: []string{
"cname _25._tcp.cnameinauthentic.example.",