Skip to content

Commit

Permalink
Add context fo vmirs.UpdateScale
Browse files Browse the repository at this point in the history
Signed-off-by: fossedihelm <ffossemo@redhat.com>
  • Loading branch information
fossedihelm committed Apr 16, 2024
1 parent b6a9f48 commit f9cdde7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Expand Up @@ -1475,15 +1475,15 @@ func (_mr *_MockReplicaSetInterfaceRecorder) GetScale(arg0, arg1, arg2 interface
return _mr.mock.ctrl.RecordCall(_mr.mock, "GetScale", arg0, arg1, arg2)
}

func (_m *MockReplicaSetInterface) UpdateScale(replicaSetName string, scale *v11.Scale) (*v11.Scale, error) {
ret := _m.ctrl.Call(_m, "UpdateScale", replicaSetName, scale)
func (_m *MockReplicaSetInterface) UpdateScale(ctx context.Context, replicaSetName string, scale *v11.Scale) (*v11.Scale, error) {
ret := _m.ctrl.Call(_m, "UpdateScale", ctx, replicaSetName, scale)
ret0, _ := ret[0].(*v11.Scale)
ret1, _ := ret[1].(error)
return ret0, ret1
}

func (_mr *_MockReplicaSetInterfaceRecorder) UpdateScale(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "UpdateScale", arg0, arg1)
func (_mr *_MockReplicaSetInterfaceRecorder) UpdateScale(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "UpdateScale", arg0, arg1, arg2)
}

func (_m *MockReplicaSetInterface) PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts v12.PatchOptions) (*v120.VirtualMachineInstanceReplicaSet, error) {
Expand Down
2 changes: 1 addition & 1 deletion staging/src/kubevirt.io/client-go/kubecli/kubevirt.go
Expand Up @@ -270,7 +270,7 @@ type VirtualMachineInstanceInterface interface {
type ReplicaSetInterface interface {
kvcorev1.VirtualMachineInstanceReplicaSetInterface
GetScale(ctx context.Context, replicaSetName string, options metav1.GetOptions) (*autov1.Scale, error)
UpdateScale(replicaSetName string, scale *autov1.Scale) (*autov1.Scale, error)
UpdateScale(ctx context.Context, replicaSetName string, scale *autov1.Scale) (*autov1.Scale, error)
PatchStatus(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions) (result *v1.VirtualMachineInstanceReplicaSet, err error)
}

Expand Down
4 changes: 2 additions & 2 deletions staging/src/kubevirt.io/client-go/kubecli/replicaset.go
Expand Up @@ -59,15 +59,15 @@ func (v *rc) GetScale(ctx context.Context, replicaSetName string, options k8smet
return
}

func (v *rc) UpdateScale(replicaSetName string, scale *autov1.Scale) (result *autov1.Scale, err error) {
func (v *rc) UpdateScale(ctx context.Context, replicaSetName string, scale *autov1.Scale) (result *autov1.Scale, err error) {
result = &autov1.Scale{}
err = v.restClient.Put().
Namespace(v.namespace).
Resource(v.resource).
Name(replicaSetName).
SubResource("scale").
Body(scale).
Do(context.Background()).
Do(ctx).
Into(result)
return
}
Expand Down
Expand Up @@ -153,7 +153,7 @@ var _ = Describe("Kubevirt VirtualMachineInstanceReplicaSet Client", func() {
ghttp.VerifyRequest("PUT", path.Join(proxyPath, rsPath, "scale")),
ghttp.RespondWithJSONEncoded(http.StatusOK, scale),
))
scaleResponse, err := client.ReplicaSet(k8sv1.NamespaceDefault).UpdateScale(rs.Name, scale)
scaleResponse, err := client.ReplicaSet(k8sv1.NamespaceDefault).UpdateScale(context.Background(), rs.Name, scale)

Expect(server.ReceivedRequests()).To(HaveLen(1))
Expect(err).ToNot(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion tests/libreplicaset/replicaset.go
Expand Up @@ -24,7 +24,7 @@ func DoScaleWithScaleSubresource(virtClient kubecli.KubevirtClient, name string,
s, err := virtClient.ReplicaSet(testsuite.GetTestNamespace(nil)).GetScale(context.Background(), name, v12.GetOptions{})
ExpectWithOffset(1, err).ToNot(HaveOccurred())
s.Spec.Replicas = scale
s, err = virtClient.ReplicaSet(testsuite.GetTestNamespace(nil)).UpdateScale(name, s)
s, err = virtClient.ReplicaSet(testsuite.GetTestNamespace(nil)).UpdateScale(context.Background(), name, s)
return err
})

Expand Down

0 comments on commit f9cdde7

Please sign in to comment.