Skip to content

Commit

Permalink
fix UT issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang0 committed Oct 16, 2024
1 parent 4e56b2b commit a03dc8d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cluster/calcium/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ func TestRemoveNode(t *testing.T) {

// fail by store.RemoveNode
store.On("ListNodeWorkloads", mock.Anything, mock.Anything, mock.Anything).Return([]*types.Workload{}, nil)
store.On("SetNodeStatus", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
store.On("RemoveNode", mock.Anything, mock.Anything).Return(types.ErrMockError).Once()
assert.Error(t, c.RemoveNode(ctx, name))

// success
store.On("SetNodeStatus", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once()
store.On("RemoveNode", mock.Anything, mock.Anything).Return(nil)
store.On("SetNodeStatus", mock.Anything, mock.Anything, int64(-1)).Return(nil)
store.On("SetNodeStatus", mock.Anything, mock.Anything, int64(-1)).Return(nil).Once()
rmgr := c.rmgr.(*resourcemocks.Manager)
rmgr.On("RemoveNode", mock.Anything, mock.Anything).Return(nil)
assert.NoError(t, c.RemoveNode(ctx, name))
Expand Down

0 comments on commit a03dc8d

Please sign in to comment.