Fix tests

This commit is contained in:
Daniel 2021-04-19 15:11:11 +02:00
parent efdc0b7849
commit 81fb67bb48
4 changed files with 12 additions and 7 deletions

View file

@ -379,12 +379,11 @@ func TestEndpointMatching(t *testing.T) {
t.Fatal(err)
}
testEndpointMatch(t, ep, (&intel.Entity{
IP: net.ParseIP("192.168.0.1"),
}).Init(), Permitted)
testEndpointMatch(t, ep, (&intel.Entity{
IP: net.ParseIP("151.101.1.164"), // nytimes.com
}).Init(), NoMatch)
entity = &intel.Entity{}
entity.SetIP(net.ParseIP("192.168.0.1"))
testEndpointMatch(t, ep, entity, Permitted)
entity.SetIP(net.ParseIP("151.101.1.164")) // nytimes.com
testEndpointMatch(t, ep, entity, NoMatch)
// Lists

View file

@ -9,6 +9,9 @@ func TestNameRecordStorage(t *testing.T) {
testNameRecord := &NameRecord{
Domain: testDomain,
Question: testQuestion,
Resolver: &ResolverInfo{
Type: "dns",
},
}
err := testNameRecord.Save()

View file

@ -33,5 +33,5 @@ func TestResolveIPAndValidate(t *testing.T) {
testReverse(t, "2606:4700:4700::1111", "one.one.one.one.", "")
testReverse(t, "93.184.216.34", "example.com.", "record could not be found: 34.216.184.93.in-addr.arpa.PTR")
testReverse(t, "185.199.109.153", "sites.github.io.", "record could not be found: 153.109.199.185.in-addr.arpa.PTR")
testReverse(t, "185.199.109.153", "cdn-185-199-109-153.github.com.", "record could not be found: 153.109.199.185.in-addr.arpa.PTR")
}

View file

@ -13,6 +13,9 @@ func TestCaching(t *testing.T) {
testNameRecord := &NameRecord{
Domain: testDomain,
Question: testQuestion,
Resolver: &ResolverInfo{
Type: "dns",
},
}
err := testNameRecord.Save()