revise auto distributor
@@ -45,12 +45,26 @@ func TestCommunismDivisionPlan(t *testing.T) {
nodes = deployedNodes()
r, err = CommunismDivisionPlan(nodes, 3)
assert.NoError(t, err)
- assert.Equal(t, r[0].Deploy, 3)
+ assert.Equal(t, r[0].Deploy, 2)
+ assert.Equal(t, r[1].Deploy, 1)
nodes = deployedNodes()
r, err = CommunismDivisionPlan(nodes, 4)
assert.NoError(t, err)
assert.Equal(t, r[0].Deploy, 3)
assert.Equal(t, r[1].Deploy, 1)
+ nodes = deployedNodes()
+ r, err = CommunismDivisionPlan(nodes, 29)
+ assert.NoError(t, err)
+ assert.Equal(t, r[0].Deploy, 10)
+ assert.Equal(t, r[1].Deploy, 9)
+ assert.Equal(t, r[2].Deploy, 6)
+ assert.Equal(t, r[3].Deploy, 4)
+ nodes = deployedNodes()
+ r, err = CommunismDivisionPlan(nodes, 37)
+ assert.NoError(t, err)
+ nodes = deployedNodes()
+ r, err = CommunismDivisionPlan(nodes, 40)
+ assert.NoError(t, err)
}
func randomDeployStatus(nodesInfo []types.NodeInfo, maxDeployed int) []types.NodeInfo {
