manual fixes

This commit is contained in:
Mike Danese 2020-02-04 18:02:08 -08:00
parent 1dcd1fb3b7
commit bfc75d9a5c
5 changed files with 28 additions and 23 deletions

View File

@ -2759,7 +2759,7 @@ func TestApplyNoExecuteTaints(t *testing.T) {
// Make node3 healthy again.
node2.Status = healthyNodeNewStatus
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node2)
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node2, metav1.UpdateOptions{})
if err != nil {
t.Errorf(err.Error())
return
@ -2905,12 +2905,12 @@ func TestSwapUnreachableNotReadyTaints(t *testing.T) {
node0.Status = newNodeStatus
node1.Status = healthyNodeNewStatus
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node0)
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node0, metav1.UpdateOptions{})
if err != nil {
t.Errorf(err.Error())
return
}
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node1)
_, err = fakeNodeHandler.UpdateStatus(context.TODO(), node1, metav1.UpdateOptions{})
if err != nil {
t.Errorf(err.Error())
return
@ -3120,7 +3120,7 @@ func TestTaintsNodeByCondition(t *testing.T) {
}
for _, test := range tests {
fakeNodeHandler.Update(context.TODO(), test.Node)
fakeNodeHandler.Update(context.TODO(), test.Node, metav1.UpdateOptions{})
if err := nodeController.syncNodeStore(fakeNodeHandler); err != nil {
t.Errorf("unexpected error: %v", err)
}
@ -3331,7 +3331,7 @@ func TestReconcileNodeLabels(t *testing.T) {
}
for _, test := range tests {
fakeNodeHandler.Update(context.TODO(), test.Node)
fakeNodeHandler.Update(context.TODO(), test.Node, metav1.UpdateOptions{})
if err := nodeController.syncNodeStore(fakeNodeHandler); err != nil {
t.Fatalf("unexpected error: %v", err)
}
@ -3355,7 +3355,6 @@ func TestReconcileNodeLabels(t *testing.T) {
if actualValue != expectedValue {
t.Errorf("%s: label %q: expected value %q, got value %q", test.Name, key, expectedValue, actualValue)
}
}
}
}

View File

@ -203,16 +203,22 @@ type conversionClient struct {
v1client.ReplicationControllerInterface
}
func (c conversionClient) Create(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
return convertCall(ctx, c.ReplicationControllerInterface.Create, rs)
func (c conversionClient) Create(ctx context.Context, rs *apps.ReplicaSet, opts metav1.CreateOptions) (*apps.ReplicaSet, error) {
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
return c.ReplicationControllerInterface.Create(ctx, rc, opts)
}, rs)
}
func (c conversionClient) Update(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
return convertCall(ctx, c.ReplicationControllerInterface.Update, rs)
func (c conversionClient) Update(ctx context.Context, rs *apps.ReplicaSet, opts metav1.UpdateOptions) (*apps.ReplicaSet, error) {
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
return c.ReplicationControllerInterface.Update(ctx, rc, opts)
}, rs)
}
func (c conversionClient) UpdateStatus(ctx context.Context, rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
return convertCall(ctx, c.ReplicationControllerInterface.UpdateStatus, rs)
func (c conversionClient) UpdateStatus(ctx context.Context, rs *apps.ReplicaSet, opts metav1.UpdateOptions) (*apps.ReplicaSet, error) {
return convertCall(func(rc *v1.ReplicationController) (*v1.ReplicationController, error) {
return c.ReplicationControllerInterface.UpdateStatus(ctx, rc, opts)
}, rs)
}
func (c conversionClient) Get(ctx context.Context, name string, options metav1.GetOptions) (*apps.ReplicaSet, error) {
@ -236,7 +242,7 @@ func (c conversionClient) Watch(ctx context.Context, opts metav1.ListOptions) (w
return nil, errors.New("Watch() is not implemented for conversionClient")
}
func (c conversionClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.ReplicaSet, err error) {
func (c conversionClient) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apps.ReplicaSet, err error) {
// This is not used by RSC.
return nil, errors.New("Patch() is not implemented for conversionClient")
}
@ -246,7 +252,7 @@ func (c conversionClient) GetScale(ctx context.Context, name string, options met
return nil, errors.New("GetScale() is not implemented for conversionClient")
}
func (c conversionClient) UpdateScale(ctx context.Context, name string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
func (c conversionClient) UpdateScale(ctx context.Context, name string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) {
// This is not used by RSC.
return nil, errors.New("UpdateScale() is not implemented for conversionClient")
}
@ -275,12 +281,12 @@ func convertList(rcList *v1.ReplicationControllerList) (*apps.ReplicaSetList, er
return rsList, nil
}
func convertCall(ctx context.Context, fn func(context.Context, *v1.ReplicationController) (*v1.ReplicationController, error), rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
func convertCall(fn func(*v1.ReplicationController) (*v1.ReplicationController, error), rs *apps.ReplicaSet) (*apps.ReplicaSet, error) {
rc, err := convertRStoRC(rs)
if err != nil {
return nil, err
}
result, err := fn(ctx, rc)
result, err := fn(rc)
if err != nil {
return nil, err
}

View File

@ -111,7 +111,7 @@ func (m *FakeLegacyHandler) Nodes() v1core.NodeInterface {
}
// Create adds a new Node to the fake store.
func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node) (*v1.Node, error) {
func (m *FakeNodeHandler) Create(_ context.Context, node *v1.Node, _ metav1.CreateOptions) (*v1.Node, error) {
m.lock.Lock()
defer func() {
m.RequestCount++
@ -202,7 +202,7 @@ func (m *FakeNodeHandler) DeleteCollection(_ context.Context, opt *metav1.Delete
}
// Update updates a Node in the fake store.
func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node) (*v1.Node, error) {
func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error) {
m.lock.Lock()
defer func() {
m.RequestCount++
@ -221,7 +221,7 @@ func (m *FakeNodeHandler) Update(_ context.Context, node *v1.Node) (*v1.Node, er
}
// UpdateStatus updates a status of a Node in the fake store.
func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node) (*v1.Node, error) {
func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node, _ metav1.UpdateOptions) (*v1.Node, error) {
m.lock.Lock()
defer func() {
m.RequestCount++
@ -266,7 +266,7 @@ func (m *FakeNodeHandler) UpdateStatus(_ context.Context, node *v1.Node) (*v1.No
// PatchStatus patches a status of a Node in the fake store.
func (m *FakeNodeHandler) PatchStatus(ctx context.Context, nodeName string, data []byte) (*v1.Node, error) {
m.RequestCount++
return m.Patch(ctx, nodeName, types.StrategicMergePatchType, data, "status")
return m.Patch(ctx, nodeName, types.StrategicMergePatchType, data, metav1.PatchOptions{}, "status")
}
// Watch watches Nodes in a fake store.
@ -275,7 +275,7 @@ func (m *FakeNodeHandler) Watch(_ context.Context, opts metav1.ListOptions) (wat
}
// Patch patches a Node in the fake store.
func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, subresources ...string) (*v1.Node, error) {
func (m *FakeNodeHandler) Patch(_ context.Context, name string, pt types.PatchType, data []byte, _ metav1.PatchOptions, subresources ...string) (*v1.Node, error) {
m.lock.Lock()
defer func() {
m.RequestCount++

View File

@ -148,7 +148,7 @@ type fakeClient struct {
failureType failureType
}
func (c *fakeClient) Create(context.Context, *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
func (c *fakeClient) Create(context.Context, *certificates.CertificateSigningRequest, metav1.CreateOptions) (*certificates.CertificateSigningRequest, error) {
if c.failureType == createError {
return nil, fmt.Errorf("fakeClient failed creating request")
}

View File

@ -1012,7 +1012,7 @@ func (c fakeClient) List(_ context.Context, opts v1.ListOptions) (*certificates.
return &csrReply, nil
}
func (c fakeClient) Create(context.Context, *certificates.CertificateSigningRequest) (*certificates.CertificateSigningRequest, error) {
func (c fakeClient) Create(context.Context, *certificates.CertificateSigningRequest, v1.CreateOptions) (*certificates.CertificateSigningRequest, error) {
if c.failureType == createError {
if c.err != nil {
return nil, c.err