Skip to content

Commit

Permalink
bump 20.01.01, add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Jan 14, 2020
1 parent 677104b commit 6f1fe56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.11.10
20.01.01
9 changes: 6 additions & 3 deletions cluster/calcium/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ func TestNetwork(t *testing.T) {
c := NewTestCluster()
ctx := context.Background()
store := &storemocks.Store{}
store.On("GetNodesByPod", mock.AnythingOfType("*context.emptyCtx"), mock.Anything, mock.Anything, mock.Anything).Return([]*types.Node{}, nil).Once()
c.store = store

// No nodes
store.On("GetNodesByPod", mock.AnythingOfType("*context.emptyCtx"), mock.Anything, mock.Anything, mock.Anything).Return(nil, types.ErrNoETCD).Once()
_, err := c.ListNetworks(ctx, "", "")
assert.Error(t, err)
// No nodes
store.On("GetNodesByPod", mock.AnythingOfType("*context.emptyCtx"), mock.Anything, mock.Anything, mock.Anything).Return([]*types.Node{}, nil).Once()
_, err = c.ListNetworks(ctx, "", "")
assert.Error(t, err)
// vaild
engine := &enginemocks.API{}
node := &types.Node{
Expand All @@ -34,7 +37,7 @@ func TestNetwork(t *testing.T) {
name := "test"
engine.On("NetworkList", mock.Anything, mock.Anything).Return([]*enginetypes.Network{{Name: name}}, nil)
store.On("GetNodesByPod", mock.AnythingOfType("*context.emptyCtx"), mock.Anything, mock.Anything, mock.Anything).Return([]*types.Node{node}, nil)
ns, err := c.ListNetworks(ctx, "", "")
ns, err := c.ListNetworks(ctx, "", "xx")
assert.NoError(t, err)
assert.Equal(t, len(ns), 1)
assert.Equal(t, ns[0].Name, name)
Expand Down
5 changes: 5 additions & 0 deletions scheduler/complex/potassium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ func TestSelectCPUNodes(t *testing.T) {
_, _, err := SelectCPUNodes(k, []types.NodeInfo{}, 1, 1, 1, false)
assert.True(t, errors.Is(err, types.ErrZeroNodes))

_, _, err = SelectCPUNodes(k, []types.NodeInfo{}, 1, 0, 1, false)
assert.True(t, errors.Is(err, types.ErrNegativeMemory))

nodes := generateNodes(2, 2, memory, 0, 10)
_, _, err = SelectCPUNodes(k, nodes, 0.5, 1, 1, false)
assert.NoError(t, err)
Expand Down Expand Up @@ -1239,6 +1242,8 @@ func TestSelectVolumeNodesNonAuto(t *testing.T) {
"/data0:/data:rw",
"/data0:/data",
}
_, _, err := SelectVolumeNodes(k, nodes, []string{"AUTO:/tmp:rw:abc"}, 2, true)
assert.Error(t, err)
res, changed, err := SelectVolumeNodes(k, nodes, volumes, 2, true)
assert.NoError(t, err)
assert.Equal(t, len(res["0"]), 2)
Expand Down

0 comments on commit 6f1fe56

Please sign in to comment.