Fix TTL breakage + cosmetic fixes
This commit is contained in:
1 parent
2a5f3f5b2d
commit
5ead7eb020
2 files changed
+7
-7
No files matched your search
@@ -69,8 +69,8 @@ func TestServerDbCacheInvalidation(t *testing.T) {
|
|||||||
MaxAnswers: 4,
|
MaxAnswers: 4,
|
||||||
})
|
})
|
||||||
wt.AssertNoErr(t, err)
|
wt.AssertNoErr(t, err)
|
||||||
defer srv.Stop()
|
|
||||||
go srv.Start()
|
go srv.Start()
|
||||||
|
defer srv.Stop()
|
||||||
time.Sleep(100 * time.Millisecond) // Allow server goroutine to start
|
time.Sleep(100 * time.Millisecond) // Allow server goroutine to start
|
||||||
|
|
||||||
testPort, err := srv.GetPort()
|
testPort, err := srv.GetPort()
|
||||||
@@ -153,7 +153,7 @@ func TestServerDbCacheInvalidation(t *testing.T) {
|
|||||||
assertInCache(t, cache, qotherPtr, "after adding a new IP")
|
assertInCache(t, cache, qotherPtr, "after adding a new IP")
|
||||||
|
|
||||||
// check that after some time, the cache entry is expired
|
// check that after some time, the cache entry is expired
|
||||||
clk.Forward(int(localTTL) + 1)
|
clk.Forward(int(DefaultLocalTTL) + 1)
|
||||||
assertNotInCache(t, cache, qotherName, "after passing some time")
|
assertNotInCache(t, cache, qotherName, "after passing some time")
|
||||||
assertNotInCache(t, cache, qwrongName, "after passing some time")
|
assertNotInCache(t, cache, qwrongName, "after passing some time")
|
||||||
|
|
||||||
@@ -226,13 +226,13 @@ func TestServerCacheExpiration(t *testing.T) {
|
|||||||
t.Logf("Zone database #2:\n%s", dbs[1].Zone)
|
t.Logf("Zone database #2:\n%s", dbs[1].Zone)
|
||||||
|
|
||||||
// Check that the DNS server returns updated information, and it will be
|
// Check that the DNS server returns updated information, and it will be
|
||||||
// cached during [0, localTTL]
|
// cached during [0, DefaultLocalTTL]
|
||||||
qName1, _ = assertExchange(t, testName1, dns.TypeA, testPort, 1, 1, 0)
|
qName1, _ = assertExchange(t, testName1, dns.TypeA, testPort, 1, 1, 0)
|
||||||
|
|
||||||
assertInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
assertInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
||||||
clk.Forward(int(localTTL) - 1)
|
clk.Forward(int(DefaultLocalTTL) - 1)
|
||||||
assertInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
assertInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
||||||
// and it will expire after localTTL
|
// and it will expire after DefaultLocalTTL
|
||||||
clk.Forward(2)
|
clk.Forward(2)
|
||||||
assertNotInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
assertNotInCache(t, cache, qName1, fmt.Sprintf("after asking for %s", testName1))
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ func TestUDPDNSServer(t *testing.T) {
|
|||||||
ListenReadTimeout: testSocketTimeout,
|
ListenReadTimeout: testSocketTimeout,
|
||||||
})
|
})
|
||||||
wt.AssertNoErr(t, err)
|
wt.AssertNoErr(t, err)
|
||||||
defer srv.Stop()
|
|
||||||
go srv.Start()
|
go srv.Start()
|
||||||
|
defer srv.Stop()
|
||||||
time.Sleep(100 * time.Millisecond) // Allow sever goroutine to start
|
time.Sleep(100 * time.Millisecond) // Allow sever goroutine to start
|
||||||
|
|
||||||
var r *dns.Msg
|
var r *dns.Msg
|
||||||
@@ -189,8 +189,8 @@ func TestTCPDNSServer(t *testing.T) {
|
|||||||
ListenReadTimeout: testSocketTimeout,
|
ListenReadTimeout: testSocketTimeout,
|
||||||
})
|
})
|
||||||
wt.AssertNoErr(t, err)
|
wt.AssertNoErr(t, err)
|
||||||
defer srv.Stop()
|
|
||||||
go srv.Start()
|
go srv.Start()
|
||||||
|
defer srv.Stop()
|
||||||
time.Sleep(100 * time.Millisecond) // Allow sever goroutine to start
|
time.Sleep(100 * time.Millisecond) // Allow sever goroutine to start
|
||||||
|
|
||||||
testPort, err := srv.GetPort()
|
testPort, err := srv.GetPort()
|
||||||
|
|||||||
Reference in new issue
Block a user