run grep-sed

This commit is contained in:
Chao Xu 2015-10-08 20:44:54 -07:00
parent 58ed8fd6fe
commit 8654227c08
8 changed files with 11 additions and 11 deletions

View File

@ -667,7 +667,7 @@ func runPatchTest(c *client.Client) {
glog.Fatalf("Failed creating patchservice: %v", err) glog.Fatalf("Failed creating patchservice: %v", err)
} }
patchBodies := map[string]map[unversioned.PatchType]struct { patchBodies := map[string]map[api.PatchType]struct {
AddLabelBody []byte AddLabelBody []byte
RemoveLabelBody []byte RemoveLabelBody []byte
RemoveAllLabelsBody []byte RemoveAllLabelsBody []byte
@ -693,7 +693,7 @@ func runPatchTest(c *client.Client) {
pb := patchBodies[c.APIVersion()] pb := patchBodies[c.APIVersion()]
execPatch := func(pt unversioned.PatchType, body []byte) error { execPatch := func(pt api.PatchType, body []byte) error {
return c.Patch(pt). return c.Patch(pt).
Resource(resource). Resource(resource).
Namespace(api.NamespaceDefault). Namespace(api.NamespaceDefault).

View File

@ -407,7 +407,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
if idx := strings.Index(contentType, ";"); idx > 0 { if idx := strings.Index(contentType, ";"); idx > 0 {
contentType = contentType[:idx] contentType = contentType[:idx]
} }
patchType := unversioned.PatchType(contentType) patchType := api.PatchType(contentType)
patchJS, err := readBody(req.Request) patchJS, err := readBody(req.Request)
if err != nil { if err != nil {
@ -432,7 +432,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
} }
// patchResource divides PatchResource for easier unit testing // patchResource divides PatchResource for easier unit testing
func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType unversioned.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) { func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType api.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) {
namespace := api.NamespaceValue(ctx) namespace := api.NamespaceValue(ctx)
original, err := patcher.Get(ctx, name) original, err := patcher.Get(ctx, name)
@ -806,7 +806,7 @@ func setListSelfLink(obj runtime.Object, req *restful.Request, namer ScopeNamer)
} }
func getPatchedJS(patchType unversioned.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) { func getPatchedJS(patchType api.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) {
switch patchType { switch patchType {
case api.JSONPatchType: case api.JSONPatchType:
patchObj, err := jsonpatch.DecodePatch(patchJS) patchObj, err := jsonpatch.DecodePatch(patchJS)

View File

@ -169,7 +169,7 @@ func (tc *patchTestCase) Run(t *testing.T) {
return return
} }
for _, patchType := range []unversioned.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} { for _, patchType := range []api.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} {
// TODO SUPPORT THIS! // TODO SUPPORT THIS!
if patchType == api.JSONPatchType { if patchType == api.JSONPatchType {
continue continue

View File

@ -50,7 +50,7 @@ func (c *RESTClient) Put() *unversioned.Request {
return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
} }
func (c *RESTClient) Patch(_ unversioned.PatchType) *unversioned.Request { func (c *RESTClient) Patch(_ api.PatchType) *unversioned.Request {
return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec) return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
} }

View File

@ -104,7 +104,7 @@ func (c *RESTClient) Put() *Request {
} }
// Patch begins a PATCH request. Short for c.Verb("Patch"). // Patch begins a PATCH request. Short for c.Verb("Patch").
func (c *RESTClient) Patch(pt unversioned.PatchType) *Request { func (c *RESTClient) Patch(pt api.PatchType) *Request {
return c.Verb("PATCH").SetHeader("Content-Type", string(pt)) return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
} }

View File

@ -23,7 +23,7 @@ import client "k8s.io/kubernetes/pkg/client/unversioned"
type RESTClient interface { type RESTClient interface {
Get() *client.Request Get() *client.Request
Post() *client.Request Post() *client.Request
Patch(unversioned.PatchType) *client.Request Patch(api.PatchType) *client.Request
Delete() *client.Request Delete() *client.Request
Put() *client.Request Put() *client.Request
} }

View File

@ -130,7 +130,7 @@ func (m *Helper) Create(namespace string, modify bool, data []byte) (runtime.Obj
func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) { func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) {
return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get() return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get()
} }
func (m *Helper) Patch(namespace, name string, pt unversioned.PatchType, data []byte) (runtime.Object, error) { func (m *Helper) Patch(namespace, name string, pt api.PatchType, data []byte) (runtime.Object, error) {
return m.RESTClient.Patch(pt). return m.RESTClient.Patch(pt).
NamespaceIfScoped(namespace, m.NamespaceScoped). NamespaceIfScoped(namespace, m.NamespaceScoped).
Resource(m.Resource). Resource(m.Resource).

View File

@ -26,7 +26,7 @@ import (
type RESTClient interface { type RESTClient interface {
Get() *client.Request Get() *client.Request
Post() *client.Request Post() *client.Request
Patch(unversioned.PatchType) *client.Request Patch(api.PatchType) *client.Request
Delete() *client.Request Delete() *client.Request
Put() *client.Request Put() *client.Request
} }