Update go dependencies (#2234)
This commit is contained in:
parent
6e099c5f57
commit
93c72ef646
1236 changed files with 37226 additions and 49844 deletions
84
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go
generated
vendored
84
vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper_test.go
generated
vendored
|
|
@ -261,42 +261,78 @@ func TestMultiRESTMapperRESTMappings(t *testing.T) {
|
|||
tcs := []struct {
|
||||
name string
|
||||
|
||||
mapper MultiRESTMapper
|
||||
input schema.GroupKind
|
||||
result []*RESTMapping
|
||||
err error
|
||||
mapper MultiRESTMapper
|
||||
groupKind schema.GroupKind
|
||||
versions []string
|
||||
result []*RESTMapping
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
mapper: MultiRESTMapper{},
|
||||
input: schema.GroupKind{Kind: "Foo"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
|
||||
name: "empty with no versions",
|
||||
mapper: MultiRESTMapper{},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
|
||||
},
|
||||
{
|
||||
name: "ignore not found",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "IGNORE_THIS"}}}},
|
||||
input: schema.GroupKind{Kind: "Foo"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{PartialKind: schema.GroupVersionKind{Kind: "Foo"}},
|
||||
name: "empty with one version",
|
||||
mapper: MultiRESTMapper{},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
|
||||
},
|
||||
{
|
||||
name: "accept first failure",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}},
|
||||
input: schema.GroupKind{Kind: "Foo"},
|
||||
result: nil,
|
||||
err: errors.New("fail on this"),
|
||||
name: "empty with multi(two) vesions",
|
||||
mapper: MultiRESTMapper{},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta", "v2"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
|
||||
},
|
||||
{
|
||||
name: "return both",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{mappings: []*RESTMapping{mapping1}}, fixedRESTMapper{mappings: []*RESTMapping{mapping2}}},
|
||||
input: schema.GroupKind{Kind: "Foo"},
|
||||
result: []*RESTMapping{mapping1, mapping2},
|
||||
name: "ignore not found with kind not exist",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "IGNORE_THIS"}}}},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: nil,
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}},
|
||||
},
|
||||
{
|
||||
name: "ignore not found with version not exist",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta"}},
|
||||
},
|
||||
{
|
||||
name: "ignore not found with multi versions not exist",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1"}}}},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta", "v2"},
|
||||
result: nil,
|
||||
err: &NoKindMatchError{GroupKind: schema.GroupKind{Kind: "Foo"}, SearchedVersions: []string{"v1beta", "v2"}},
|
||||
},
|
||||
{
|
||||
name: "accept first failure",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{err: errors.New("fail on this")}, fixedRESTMapper{mappings: []*RESTMapping{mapping1}}},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta"},
|
||||
result: nil,
|
||||
err: errors.New("fail on this"),
|
||||
},
|
||||
{
|
||||
name: "return both",
|
||||
mapper: MultiRESTMapper{fixedRESTMapper{mappings: []*RESTMapping{mapping1}}, fixedRESTMapper{mappings: []*RESTMapping{mapping2}}},
|
||||
groupKind: schema.GroupKind{Kind: "Foo"},
|
||||
versions: []string{"v1beta"},
|
||||
result: []*RESTMapping{mapping1, mapping2},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tcs {
|
||||
actualResult, actualErr := tc.mapper.RESTMappings(tc.input)
|
||||
actualResult, actualErr := tc.mapper.RESTMappings(tc.groupKind, tc.versions...)
|
||||
if e, a := tc.result, actualResult; !reflect.DeepEqual(e, a) {
|
||||
t.Errorf("%s: expected %v, got %v", tc.name, e, a)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue