mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-21 12:48:30 +00:00
API Machinery, Kubectl and tests
Kubernetes-commit: 0e1d50e70fdc9ed838d75a7a1abbe5fa607d22a1
This commit is contained in:
parent
d84f9adf31
commit
35efedd302
@ -127,5 +127,5 @@ func (s oldResourceShimType) List(opts metav1.ListOptions) (runtime.Object, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s oldResourceShimType) Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error) {
|
func (s oldResourceShimType) Patch(name string, pt types.PatchType, data []byte) (*unstructured.Unstructured, error) {
|
||||||
return s.ResourceInterface.Patch(name, pt, data, metav1.UpdateOptions{}, s.subresources...)
|
return s.ResourceInterface.Patch(name, pt, data, metav1.PatchOptions{}, s.subresources...)
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ func TestPatch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer srv.Close()
|
defer srv.Close()
|
||||||
|
|
||||||
got, err := cl.Resource(resource).Namespace(tc.namespace).Patch(tc.name, types.StrategicMergePatchType, tc.patch, metav1.UpdateOptions{}, tc.subresource...)
|
got, err := cl.Resource(resource).Namespace(tc.namespace).Patch(tc.name, types.StrategicMergePatchType, tc.patch, metav1.PatchOptions{}, tc.subresource...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("unexpected error when patching %q: %v", tc.name, err)
|
t.Errorf("unexpected error when patching %q: %v", tc.name, err)
|
||||||
continue
|
continue
|
||||||
|
@ -333,7 +333,7 @@ func (c *dynamicResourceClient) Watch(opts metav1.ListOptions) (watch.Interface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: opts are currently ignored.
|
// TODO: opts are currently ignored.
|
||||||
func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
||||||
var uncastRet runtime.Object
|
var uncastRet runtime.Object
|
||||||
var err error
|
var err error
|
||||||
switch {
|
switch {
|
||||||
|
@ -96,7 +96,7 @@ func (tc *patchTestCase) runner(t *testing.T) {
|
|||||||
client := NewSimpleDynamicClient(runtime.NewScheme(), tc.object)
|
client := NewSimpleDynamicClient(runtime.NewScheme(), tc.object)
|
||||||
resourceInterface := client.Resource(schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource}).Namespace(testNamespace)
|
resourceInterface := client.Resource(schema.GroupVersionResource{Group: testGroup, Version: testVersion, Resource: testResource}).Namespace(testNamespace)
|
||||||
|
|
||||||
got, recErr := resourceInterface.Patch(testName, tc.patchType, tc.patchBytes, metav1.UpdateOptions{})
|
got, recErr := resourceInterface.Patch(testName, tc.patchType, tc.patchBytes, metav1.PatchOptions{})
|
||||||
|
|
||||||
if err := tc.verifyErr(recErr); err != nil {
|
if err := tc.verifyErr(recErr); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -37,7 +37,7 @@ type ResourceInterface interface {
|
|||||||
Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
|
Get(name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error)
|
||||||
List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
|
List(opts metav1.ListOptions) (*unstructured.UnstructuredList, error)
|
||||||
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
Watch(opts metav1.ListOptions) (watch.Interface, error)
|
||||||
Patch(name string, pt types.PatchType, data []byte, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error)
|
Patch(name string, pt types.PatchType, data []byte, options metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type NamespaceableResourceInterface interface {
|
type NamespaceableResourceInterface interface {
|
||||||
|
@ -283,7 +283,7 @@ func (c *dynamicResourceClient) Watch(opts metav1.ListOptions) (watch.Interface,
|
|||||||
WatchWithSpecificDecoders(wrappedDecoderFn, unstructured.UnstructuredJSONScheme)
|
WatchWithSpecificDecoders(wrappedDecoderFn, unstructured.UnstructuredJSONScheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
func (c *dynamicResourceClient) Patch(name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*unstructured.Unstructured, error) {
|
||||||
result := c.client.client.
|
result := c.client.client.
|
||||||
Patch(pt).
|
Patch(pt).
|
||||||
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
AbsPath(append(c.makeURLSegments(name), subresources...)...).
|
||||||
|
Loading…
Reference in New Issue
Block a user