update StatusDetails to handle Groups

This commit is contained in:
deads2k
2015-12-10 13:32:29 -05:00
parent 5c4479f542
commit 9fda7f1812
75 changed files with 303 additions and 238 deletions

View File

@@ -58,7 +58,7 @@ func TestTryAcquireOrRenew(t *testing.T) {
{
verb: "get",
reaction: func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, errors.NewNotFound(action.GetVerb(), action.(testclient.GetAction).GetName())
return true, nil, errors.NewNotFound(api.Resource(action.(testclient.GetAction).GetResource()), action.(testclient.GetAction).GetName())
},
},
{

View File

@@ -896,7 +896,7 @@ func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *h
message = strings.TrimSpace(string(body))
}
retryAfter, _ := retryAfterSeconds(resp)
return errors.NewGenericServerResponse(resp.StatusCode, req.Method, r.resource, r.resourceName, message, retryAfter, true)
return errors.NewGenericServerResponse(resp.StatusCode, req.Method, unversioned.GroupResource{Group: r.groupVersion.Group, Resource: r.resource}, r.resourceName, message, retryAfter, true)
}
// isTextResponse returns true if the response appears to be a textual media type.

View File

@@ -181,7 +181,7 @@ func (o objects) Kind(kind unversioned.GroupVersionKind, name string) (runtime.O
}
return out, nil
}
return nilValue, errors.NewNotFound(kind.Kind, name)
return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name)
}
index := o.last[kind.Kind]
@@ -189,7 +189,7 @@ func (o objects) Kind(kind unversioned.GroupVersionKind, name string) (runtime.O
index = len(arr) - 1
}
if index < 0 {
return nilValue, errors.NewNotFound(kind.Kind, name)
return nilValue, errors.NewNotFound(unversioned.GroupResource{Group: kind.Group, Resource: kind.Kind}, name)
}
out, err := o.scheme.Copy(arr[index])
if err != nil {

View File

@@ -56,9 +56,9 @@ func TestErrors(t *testing.T) {
o.Add(&api.List{
Items: []runtime.Object{
// This first call to List will return this error
&(errors.NewNotFound("ServiceList", "").(*errors.StatusError).ErrStatus),
&(errors.NewNotFound(api.Resource("ServiceList"), "").(*errors.StatusError).ErrStatus),
// The second call to List will return this error
&(errors.NewForbidden("ServiceList", "", nil).(*errors.StatusError).ErrStatus),
&(errors.NewForbidden(api.Resource("ServiceList"), "", nil).(*errors.StatusError).ErrStatus),
},
})
client := &Fake{}