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: Monis Khan <mkhan@redhat.com>
This commit is contained in:
Monis Khan
2017-08-08 17:14:42 -04:00
committed by Dr. Stefan Schimanski
parent 8728576236
commit 3ab143bc18

View File

@@ -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) {
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
} }