Skip to content

Commit c949b0c

Browse files
committed
fixed mock
Signed-off-by: Omer Aplatony <[email protected]>
1 parent ce28c13 commit c949b0c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

vertical-pod-autoscaler/pkg/updater/logic/updater_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
"k8s.io/apimachinery/pkg/labels"
3434
"k8s.io/apimachinery/pkg/runtime"
35+
"k8s.io/apimachinery/pkg/types"
3536
"k8s.io/client-go/kubernetes/fake"
3637
featuregatetesting "k8s.io/component-base/featuregate/testing"
3738

@@ -232,6 +233,7 @@ func testRunOnceBase(
232233
Get()
233234

234235
pods[i].Labels = labels
236+
pods[i].UID = types.UID(fmt.Sprintf("pod-uid-%d", i))
235237

236238
inplace.On("CanInPlaceUpdate", pods[i]).Return(canInPlaceUpdate)
237239
if shouldInPlaceFail {
@@ -251,7 +253,7 @@ func testRunOnceBase(
251253
vpaLister := &test.VerticalPodAutoscalerListerMock{}
252254

253255
podLister := &test.PodListerMock{}
254-
podLister.On("List").Return(pods, nil)
256+
podLister.On("List", selector).Return(pods, nil)
255257
targetRef := &v1.CrossVersionObjectReference{
256258
Kind: rc.Kind,
257259
Name: rc.Name,
@@ -392,7 +394,7 @@ func TestRunOnceIgnoreNamespaceMatchingPods(t *testing.T) {
392394
vpaLister := &test.VerticalPodAutoscalerListerMock{}
393395

394396
podLister := &test.PodListerMock{}
395-
podLister.On("List").Return(pods, nil)
397+
podLister.On("List", selector).Return(pods, nil)
396398
targetRef := &v1.CrossVersionObjectReference{
397399
Kind: rc.Kind,
398400
Name: rc.Name,

vertical-pod-autoscaler/pkg/utils/test/test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (m *PodListerMock) Pods(namespace string) v1.PodNamespaceLister {
156156

157157
// List is a mock implementation of PodLister.List
158158
func (m *PodListerMock) List(selector labels.Selector) (ret []*apiv1.Pod, err error) {
159-
args := m.Called()
159+
args := m.Called(selector)
160160
var returnArg []*apiv1.Pod
161161
if args.Get(0) != nil {
162162
returnArg = args.Get(0).([]*apiv1.Pod)

0 commit comments

Comments
 (0)