32 lines
589 B
Go
32 lines
589 B
Go
|
package dns
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func cleanCache() {
|
||
|
cnameCache.Flush()
|
||
|
txtRepoCache.Flush()
|
||
|
}
|
||
|
|
||
|
func TestAltCNAME(t *testing.T) {
|
||
|
defer cleanCache()
|
||
|
|
||
|
res, err := lookupCNAMETxt("moxxy.org")
|
||
|
if err != nil {
|
||
|
t.Fatalf("Unexpected error: %v", err)
|
||
|
}
|
||
|
if res != "moxxy.pages.polynom.me" {
|
||
|
t.Fatalf("Unexpected alt CNAME: %s", res)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestLookupCNAMEWithAlt(t *testing.T) {
|
||
|
defer cleanCache()
|
||
|
|
||
|
res, err := LookupCNAME("moxxy.org")
|
||
|
if err != nil {
|
||
|
t.Fatalf("Unexpected error: %v", err)
|
||
|
}
|
||
|
if res != "moxxy.pages.polynom.me" {
|
||
|
t.Fatalf("Unexpected alt CNAME: %s", res)
|
||
|
}
|
||
|
}
|