From 39a7d58fb684a6e631795bbb2cdf58562df211fd Mon Sep 17 00:00:00 2001 From: CMGS Date: Tue, 31 Jan 2023 16:42:54 +0800 Subject: [PATCH] seems deploy is fine now --- cluster/calcium/network.go | 1 - engine/mocks/fakeengine/mock.go | 1 - resource/cobalt/alloc.go | 4 ++-- store/etcdv3/node_test.go | 2 +- store/redis/node_test.go | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cluster/calcium/network.go b/cluster/calcium/network.go index 6d04b368f..f66dc07cc 100644 --- a/cluster/calcium/network.go +++ b/cluster/calcium/network.go @@ -45,7 +45,6 @@ func (c *Calcium) ConnectNetwork(ctx context.Context, network, target, ipv4, ipv logger := log.WithFunc("calcium.ConnectNetwork").WithField("network", network).WithField("target", target).WithField("ipv4", ipv4).WithField("ipv6", ipv6) workload, err := c.GetWorkload(ctx, target) if err != nil { - logger.Error(ctx, err) return nil, err } diff --git a/engine/mocks/fakeengine/mock.go b/engine/mocks/fakeengine/mock.go index e9fe30269..9dcdee28c 100644 --- a/engine/mocks/fakeengine/mock.go +++ b/engine/mocks/fakeengine/mock.go @@ -107,7 +107,6 @@ func MakeClient(ctx context.Context, config coretypes.Config, nodename, endpoint 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("VirtualizationCopyFrom", mock.Anything, mock.Anything, mock.Anything).Return([]byte("d1...\nd2...\n"), 0, 0, int64(0), nil) // e.On("ResourceValidate", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) return e, nil diff --git a/resource/cobalt/alloc.go b/resource/cobalt/alloc.go index 1a90a1f2c..25a5f5616 100644 --- a/resource/cobalt/alloc.go +++ b/resource/cobalt/alloc.go @@ -27,8 +27,8 @@ func (m Manager) Alloc(ctx context.Context, nodename string, deployCount int, op logger := log.WithFunc("resource.coblat.Alloc") // index -> no, map by plugin name - workloadsParams := []types.Resources{} - engineParams := []types.Resources{} + workloadsParams := make([]types.Resources, deployCount) + engineParams := make([]types.Resources, deployCount) // init engine args for i := 0; i < deployCount; i++ { diff --git a/store/etcdv3/node_test.go b/store/etcdv3/node_test.go index 58926050e..9f117615a 100644 --- a/store/etcdv3/node_test.go +++ b/store/etcdv3/node_test.go @@ -161,7 +161,7 @@ func TestGetNodesByPod(t *testing.T) { assert.NoError(t, err) ns, err = m.GetNodesByPod(ctx, &types.NodeFilter{All: false}) assert.NoError(t, err) - assert.Empty(t, ns) + assert.Len(t, ns, 1) // because mock forced to up, so here is 1 ns, err = m.GetNodesByPod(ctx, &types.NodeFilter{All: true}) assert.NoError(t, err) assert.NotEmpty(t, ns) diff --git a/store/redis/node_test.go b/store/redis/node_test.go index f5fa77514..f110876e7 100644 --- a/store/redis/node_test.go +++ b/store/redis/node_test.go @@ -130,7 +130,7 @@ func (s *RediaronTestSuite) TestGetNodesByPod() { s.NoError(err) ns, err = s.rediaron.GetNodesByPod(ctx, &types.NodeFilter{All: false}) s.NoError(err) - s.Empty(ns) + s.Len(ns, 1) // because mock forced to up, so here is 1 ns, err = s.rediaron.GetNodesByPod(ctx, &types.NodeFilter{All: true}) s.NoError(err) s.NotEmpty(ns)