mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Merge pull request #18356 from deads2k/make-broken-test-correct
Auto commit by PR queue bot
This commit is contained in:
commit
90b5db167f
@ -210,15 +210,19 @@ func TestRESTMapperResourceSingularizer(t *testing.T) {
|
|||||||
{Kind: "Status", MixedCase: false, Plural: "statuses", Singular: "status"},
|
{Kind: "Status", MixedCase: false, Plural: "statuses", Singular: "status"},
|
||||||
|
|
||||||
{Kind: "lowercase", MixedCase: false, Plural: "lowercases", Singular: "lowercase"},
|
{Kind: "lowercase", MixedCase: false, Plural: "lowercases", Singular: "lowercase"},
|
||||||
// Don't add extra s if the original object is already plural
|
// TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular
|
||||||
{Kind: "lowercases", MixedCase: false, Plural: "lowercases", Singular: "lowercases"},
|
// old (incorrect), coment: Don't add extra s if the original object is already plural
|
||||||
|
{Kind: "lowercases", MixedCase: false, Plural: "lowercaseses", Singular: "lowercases"},
|
||||||
}
|
}
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces)
|
mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces)
|
||||||
// create singular/plural mapping
|
// create singular/plural mapping
|
||||||
mapper.Add(testGroupVersion.WithKind(testCase.Kind), RESTScopeNamespace, testCase.MixedCase)
|
mapper.Add(testGroupVersion.WithKind(testCase.Kind), RESTScopeNamespace, testCase.MixedCase)
|
||||||
|
|
||||||
singular, _ := mapper.ResourceSingularizer(testCase.Plural)
|
singular, err := mapper.ResourceSingularizer(testCase.Plural)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%d: unexpected error: %v", i, err)
|
||||||
|
}
|
||||||
if singular != testCase.Singular {
|
if singular != testCase.Singular {
|
||||||
t.Errorf("%d: mismatched singular: %s, should be %s", i, singular, testCase.Singular)
|
t.Errorf("%d: mismatched singular: %s, should be %s", i, singular, testCase.Singular)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user