INNER CODE UNIT · Go
TestNamespaceIndexFuncWrongType
jtblin/kube2iam · namespace_test.go:96
func TestNamespaceIndexFuncWrongType(t *testing.T) {
_, err := NamespaceIndexFunc("not-a-namespace")
if err == nil {
t.Error("expected error for wrong type, got nil")
}
}
// ---- NamespaceHandler events ------------------------------------------------
func TestNamespaceHandlerOnAdd(t *testing.T) {
h := NewNamespaceHandler("ns-key")
ns := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{
Name: "test",
Annotations: map[string]string{"ns-key": `["my-role"]`},
}}
// Should not panic
h.OnAdd(ns, false)
}