Fix host resolution and concurrent cache updates

This commit is contained in:
Sebastian Unterschütz committed 2026-10-27 22:23:59 +01:00
1 parent 92b1c40cb8
commit fa7446e5f7
11 files changed
+648 -113

No files matched your search

+5 -5
View File
@@ -314,7 +314,7 @@ func TestGetByShortcut_MatchFresh(t *testing.T) {
return s
}
e, found, fresh := c.GetByShortcut("web01", normalize)
e, found, fresh, _ := c.GetByShortcut("web01", normalize)
if !found {
t.Fatal("expected entry to be found")
}
@@ -340,7 +340,7 @@ func TestGetByShortcut_MatchStale(t *testing.T) {
return s
}
_, found, fresh := c.GetByShortcut("web01", normalize)
_, found, fresh, _ := c.GetByShortcut("web01", normalize)
if !found {
t.Fatal("expected entry to be found even when stale")
}
@@ -353,7 +353,7 @@ func TestGetByShortcut_NotFound(t *testing.T) {
c := New("", 3600)
c.Upsert(Entry{Name: "db01.example.com", IP: "10.0.0.2", Kind: "device"})
_, found, _ := c.GetByShortcut("web01", func(s string) string { return s })
_, found, _, _ := c.GetByShortcut("web01", func(s string) string { return s })
if found {
t.Error("should not find an entry that does not match the shortcut")
}
@@ -361,7 +361,7 @@ func TestGetByShortcut_NotFound(t *testing.T) {
func TestGetByShortcut_EmptyCache(t *testing.T) {
c := New("", 3600)
_, found, _ := c.GetByShortcut("web01", func(s string) string { return s })
_, found, _, _ := c.GetByShortcut("web01", func(s string) string { return s })
if found {
t.Error("empty cache should return found=false")
}
@@ -381,7 +381,7 @@ func TestGetByShortcut_MultiDomain(t *testing.T) {
return s
}
e, found, _ := c.GetByShortcut("web01", normalize)
e, found, _, _ := c.GetByShortcut("web01", normalize)
if !found {
t.Fatal("should match entry with second configured domain")
}