Commit 3ab143bc authored by Monis Khan's avatar Monis Khan Committed by Dr. Stefan Schimanski

Update etcd path test to always use kindWhiteList

Most types now have valid rest mappings because NewDefaultRESTMapperFromScheme no longer ignores certain import paths. Thus we can no longer use the lack of a valid REST mapping as an indicator for when to use kindWhiteList. Thus kindWhiteList now serves as a whitelist for all kinds and not just those that formally had no mapping. This does mean that we could whitelist kinds due to a name conflict, but that is unlikely as names such as GetOptions are not appropriate for new objects. Signed-off-by: 's avatarMonis Khan <mkhan@redhat.com>
parent 87285762
...@@ -438,7 +438,7 @@ var ephemeralWhiteList = createEphemeralWhiteList( ...@@ -438,7 +438,7 @@ var ephemeralWhiteList = createEphemeralWhiteList(
// -- // --
) )
// Only add kinds to this list when there is no mapping from GVK to GVR (and thus there is no way to create the object) // Only add kinds to this list when there is no way to create the object
var kindWhiteList = sets.NewString( var kindWhiteList = sets.NewString(
// k8s.io/kubernetes/pkg/api/v1 // k8s.io/kubernetes/pkg/api/v1
"DeleteOptions", "DeleteOptions",
...@@ -496,14 +496,14 @@ func TestEtcdStoragePath(t *testing.T) { ...@@ -496,14 +496,14 @@ func TestEtcdStoragePath(t *testing.T) {
kind := gvk.Kind kind := gvk.Kind
pkgPath := apiType.PkgPath() pkgPath := apiType.PkgPath()
if kindWhiteList.Has(kind) {
kindSeen.Insert(kind)
continue
}
mapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version) mapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
if err != nil { if err != nil {
kindSeen.Insert(kind) t.Errorf("unexpected error getting mapping for %s from %s with GVK %s: %v", kind, pkgPath, gvk, err)
if kindWhiteList.Has(kind) {
// t.Logf("skipping test for %s from %s because its GVK %s is whitelisted and has no mapping", kind, pkgPath, gvk)
} else {
t.Errorf("no mapping found for %s from %s but its GVK %s is not whitelisted", kind, pkgPath, gvk)
}
continue continue
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment