INNER CODE UNIT · Go

TestGetNamespaceRoleAnnotationMissingKey

jtblin/kube2iam · namespace_test.go:65

func TestGetNamespaceRoleAnnotationMissingKey(t *testing.T) {
	ns := &v1.Namespace{}
	ns.Annotations = map[string]string{"other-key": `["role"]`}
	result := GetNamespaceRoleAnnotation(ns, "namespaceKey")
	if result != nil {
		t.Errorf("expected nil for missing annotation key, got %v", result)
	}
}

func TestGetNamespaceRoleAnnotationNilAnnotations(t *testing.T) {
	ns := &v1.Namespace{}
	// No annotations set at all
	result := GetNamespaceRoleAnnotation(ns, "namespaceKey")
	if result != nil {
		t.Errorf("expected nil for nil annotations, got %v", result)
	}
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…