optimize cpu allocation logic
@@ -507,6 +507,19 @@ func TestCPUWithMaxShareLimit(t *testing.T) {
_, _, err = SelectCPUNodes(k, nodes, nil, 1.7, 1, 3, false)
assert.True(t, errors.Is(err, types.ErrInsufficientRes))
assert.Contains(t, err.Error(), "available: 2")
+
+ // test2
+ nodes = []resourcetypes.ScheduleInfo{
+ {
+ NodeMeta: types.NodeMeta{
+ CPU: types.CPUMap{"0": 0, "1": 0, "2": 100, "3": 100},
+ MemCap: 12 * int64(units.GiB),
+ Name: "nodes1",
+ },
+ },
+ }
+ _, _, err = SelectCPUNodes(k, nodes, nil, 1.2, 1, 1, false)
+ assert.Nil(t, err)
}
func TestCpuOverSell(t *testing.T) {
