feat: search multiple NetBox instances with isolated host identities
Release / release (push) Successful in 5m16s
Release / release (push) Successful in 5m16s
This commit is contained in:
1 parent
a2a6dd7591
commit
7f53b90266
26 files changed
+1299
-115
No files matched your search
Vendored
+12
@@ -483,3 +483,15 @@ func TestUpsertPreservesUsageHistory(t *testing.T) {
|
||||
t.Fatalf("history lost: %+v", after)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSearchMatchesHostnamesAcrossQualifiedSources(t *testing.T) {
|
||||
c := New("", 3600)
|
||||
c.Upsert(Entry{Name: "office/web01", IP: "10.0.0.1"})
|
||||
c.Upsert(Entry{Name: "lab/web01", IP: "10.0.0.2"})
|
||||
c.Upsert(Entry{Name: "lab/db01", IP: "10.0.0.3"})
|
||||
for query, want := range map[string]int{"web": 2, "office/web": 1, "lab/": 2, "WEB": 2} {
|
||||
if got := len(c.Search(query)); got != want {
|
||||
t.Errorf("Search(%q)=%d, want %d", query, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user