Skip to content

Commit

Permalink
remove usless code
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Feb 3, 2023
1 parent fe010d9 commit b035c80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
4 changes: 0 additions & 4 deletions cluster/calcium/remap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)

Expand Down
13 changes: 8 additions & 5 deletions engine/mocks/fakeengine/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"fmt"
"io"

"github.com/docker/go-units"
Expand Down Expand Up @@ -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)
Expand All @@ -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
}
6 changes: 0 additions & 6 deletions engine/types/virtualization.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,3 @@ type VirtualizationWaitResult struct {
Message string
Code int64
}

// VirtualizationRemapMessage returns from engine
type VirtualizationRemapMessage struct {
ID string
Error error
}

0 comments on commit b035c80

Please sign in to comment.