mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
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:
committed by
Dr. Stefan Schimanski
parent
8728576236
commit
3ab143bc18
@@ -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(
|
||||
// k8s.io/kubernetes/pkg/api/v1
|
||||
"DeleteOptions",
|
||||
@@ -496,14 +496,14 @@ func TestEtcdStoragePath(t *testing.T) {
|
||||
kind := gvk.Kind
|
||||
pkgPath := apiType.PkgPath()
|
||||
|
||||
if kindWhiteList.Has(kind) {
|
||||
kindSeen.Insert(kind)
|
||||
continue
|
||||
}
|
||||
|
||||
mapping, err := mapper.RESTMapping(gvk.GroupKind(), gvk.Version)
|
||||
if err != nil {
|
||||
kindSeen.Insert(kind)
|
||||
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)
|
||||
}
|
||||
t.Errorf("unexpected error getting mapping for %s from %s with GVK %s: %v", kind, pkgPath, gvk, err)
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user