net/dnsfallback: allow setting log function (#5550)

This broke a test in corp that enforces we don't use the log package.

Signed-off-by: Andrew Dunham <andrew@tailscale.com>
This commit is contained in:
Andrew Dunham
2022-09-06 11:19:50 -04:00
committed by GitHub
parent b8596f2a2f
commit f52a659076
2 changed files with 38 additions and 10 deletions

View File

@ -25,6 +25,11 @@ func TestGetDERPMap(t *testing.T) {
}
func TestCache(t *testing.T) {
oldlog := logfunc.Load()
SetLogger(t.Logf)
t.Cleanup(func() {
SetLogger(oldlog)
})
cacheFile := filepath.Join(t.TempDir(), "cache.json")
// Write initial cache value
@ -101,6 +106,11 @@ func TestCache(t *testing.T) {
}
func TestCacheUnchanged(t *testing.T) {
oldlog := logfunc.Load()
SetLogger(t.Logf)
t.Cleanup(func() {
SetLogger(oldlog)
})
cacheFile := filepath.Join(t.TempDir(), "cache.json")
// Write initial cache value