diff --git a/cluster/calcium/remap_test.go b/cluster/calcium/remap_test.go index 33f3e9ff7..2c7f98303 100644 --- a/cluster/calcium/remap_test.go +++ b/cluster/calcium/remap_test.go @@ -5,7 +5,6 @@ import ( "testing" enginemocks "github.com/projecteru2/core/engine/mocks" - enginetypes "github.com/projecteru2/core/engine/types" lockmocks "github.com/projecteru2/core/lock/mocks" "github.com/projecteru2/core/log" resourcemocks "github.com/projecteru2/core/resource/mocks" @@ -36,9 +35,6 @@ func TestRemapResource(t *testing.T) { Resources: resourcetypes.Resources{}, } store.On("ListNodeWorkloads", mock.Anything, mock.Anything, mock.Anything).Return([]*types.Workload{workload}, nil) - ch := make(chan enginetypes.VirtualizationRemapMessage, 1) - ch <- enginetypes.VirtualizationRemapMessage{} - close(ch) _, err := c.doRemapResource(context.Background(), node) assert.Nil(t, err) diff --git a/engine/mocks/fakeengine/mock.go b/engine/mocks/fakeengine/mock.go index b40e93ae6..44355d6cf 100644 --- a/engine/mocks/fakeengine/mock.go +++ b/engine/mocks/fakeengine/mock.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "context" + "fmt" "io" "github.com/docker/go-units" @@ -116,10 +117,6 @@ func MakeClient(ctx context.Context, config coretypes.Config, nodename, endpoint ID = utils.RandomString(64) return &enginetypes.VirtualizationCreated{ID: ID, Name: "mock-test-cvm" + utils.RandomString(6)} }, nil) - ch := make(chan enginetypes.VirtualizationRemapMessage, 1) - ch <- enginetypes.VirtualizationRemapMessage{ID: ID} - close(ch) - e.On("VirtualizationResourceRemap", mock.Anything, mock.Anything).Return((<-chan enginetypes.VirtualizationRemapMessage)(ch), nil) e.On("VirtualizationCopyTo", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) e.On("VirtualizationStart", mock.Anything, mock.Anything).Return(nil) e.On("VirtualizationStop", mock.Anything, mock.Anything, mock.Anything).Return(nil) @@ -133,7 +130,13 @@ func MakeClient(ctx context.Context, config coretypes.Config, nodename, endpoint e.On("VirtualizationAttach", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(attachData, attachData, writeBuffer, nil) e.On("VirtualizationResize", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) e.On("VirtualizationWait", mock.Anything, mock.Anything, mock.Anything).Return(&enginetypes.VirtualizationWaitResult{Message: "", Code: 0}, nil) - e.On("VirtualizationUpdateResource", mock.Anything, mock.Anything, mock.Anything).Return(nil) + e.On("VirtualizationUpdateResource", mock.Anything, mock.Anything, mock.Anything).Return( + func(_ context.Context, ID string, params resourcetypes.Resources) error { + fmt.Println(ID) + litter.Dump(params) + return nil + }, + ) e.On("VirtualizationCopyFrom", mock.Anything, mock.Anything, mock.Anything).Return([]byte("d1...\nd2...\n"), 0, 0, int64(0), nil) return e, nil } diff --git a/engine/types/virtualization.go b/engine/types/virtualization.go index fb68df836..bfcccca81 100644 --- a/engine/types/virtualization.go +++ b/engine/types/virtualization.go @@ -59,9 +59,3 @@ type VirtualizationWaitResult struct { Message string Code int64 } - -// VirtualizationRemapMessage returns from engine -type VirtualizationRemapMessage struct { - ID string - Error error -}