layer1: add namespace summary active helper

This commit is contained in:
Naeel
2026-04-26 11:46:47 +03:00
parent 9f0e911b9d
commit fed69da335
3 changed files with 29 additions and 0 deletions
+4
View File
@@ -81,6 +81,10 @@ type NamespaceManagerSummary struct {
Subscribers []string
}
func (summary NamespaceManagerSummary) HasActiveNamespaces() bool {
return summary.LiveNamespaces > 0
}
type ManagedNamespaceWatcherConfig struct {
Component string
Namespaces []string
+11
View File
@@ -161,3 +161,14 @@ func TestNamespaceManagerSummaryZeroValue(t *testing.T) {
t.Fatalf("expected zero total namespaces")
}
}
func TestNamespaceManagerSummaryHasActiveNamespaces(t *testing.T) {
summary := NamespaceManagerSummary{LiveNamespaces: 1}
if !summary.HasActiveNamespaces() {
t.Fatalf("expected positive live count to report active namespaces")
}
summary.LiveNamespaces = 0
if summary.HasActiveNamespaces() {
t.Fatalf("expected zero live count to report no active namespaces")
}
}