added watch namespaces support

This commit is contained in:
Safwan
2026-07-14 13:09:14 +05:00
parent 0cfbe10125
commit 0ef47cdc4d
7 changed files with 270 additions and 26 deletions
+19
View File
@@ -9,6 +9,25 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
)
func TestBuildDefaultNamespaces(t *testing.T) {
if got := buildDefaultNamespaces(nil); got != nil {
t.Errorf("empty input should return nil, got %v", got)
}
if got := buildDefaultNamespaces([]string{}); got != nil {
t.Errorf("empty slice should return nil, got %v", got)
}
got := buildDefaultNamespaces([]string{"team-a", "team-b", "team-c"})
if len(got) != 3 {
t.Fatalf("expected 3 entries, got %d", len(got))
}
for _, ns := range []string{"team-a", "team-b", "team-c"} {
if _, ok := got[ns]; !ok {
t.Errorf("missing namespace %q in %v", ns, got)
}
}
}
func TestAddOptionalSchemesRegistersCSI(t *testing.T) {
// Reset to a clean scheme for the test.
runtimeScheme = runtime.NewScheme()