|
|
|
@@ -169,7 +169,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
containerID: "fakeID2",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("8000m", "8000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
|
|
|
|
|
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -181,7 +181,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
containerID: "fakeID2",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("1000m", "1000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer2", "1000m", "1000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(4), // expect sibling of partial core
|
|
|
|
@@ -195,7 +195,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(2, 3, 6, 7),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 4, 5),
|
|
|
|
|
pod: makePod("2000m", "2000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "2000m", "2000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(1, 5),
|
|
|
|
@@ -209,7 +209,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID3": cpuset.NewCPUSet(2, 3, 6, 7),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 4, 5),
|
|
|
|
|
pod: makePod("4000m", "4000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "4000m", "4000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(2, 3, 6, 7),
|
|
|
|
@@ -223,7 +223,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(2),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11),
|
|
|
|
|
pod: makePod("6000m", "6000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "6000m", "6000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(1, 3, 5, 7, 9, 11),
|
|
|
|
@@ -237,7 +237,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(1, 5),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 2, 3, 4, 6, 7, 8, 9, 10, 11),
|
|
|
|
|
pod: makePod("6000m", "6000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "6000m", "6000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(2, 3, 4, 8, 9, 10),
|
|
|
|
@@ -251,7 +251,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("4000m", "4000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer1", "4000m", "4000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(4, 5, 6, 7),
|
|
|
|
@@ -265,7 +265,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(4, 5),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 3, 6, 7),
|
|
|
|
|
pod: makePod("4000m", "4000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer1", "4000m", "4000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(1, 3, 6, 7),
|
|
|
|
@@ -279,7 +279,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(2),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11),
|
|
|
|
|
pod: makePod("8000m", "8000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "8000m", "8000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(1, 3, 4, 5, 7, 9, 10, 11),
|
|
|
|
@@ -291,7 +291,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
containerID: "fakeID1",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("1000m", "2000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer1", "1000m", "2000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -303,7 +303,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
containerID: "fakeID4",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("977m", "977m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer4", "977m", "977m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -317,7 +317,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(1, 2, 3, 4, 5, 6),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 7),
|
|
|
|
|
pod: makePod("2000m", "2000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "2000m", "2000m"),
|
|
|
|
|
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -331,7 +331,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(1, 2, 3),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 4, 5, 6, 7, 8, 9, 10, 11),
|
|
|
|
|
pod: makePod("10000m", "10000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "10000m", "10000m"),
|
|
|
|
|
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -347,7 +347,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(3, 11, 4, 5, 6, 7),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: largeTopoCPUSet.Difference(cpuset.NewCPUSet(3, 11, 4, 5, 6, 7)),
|
|
|
|
|
pod: makePod("72000m", "72000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "72000m", "72000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: largeTopoSock0CPUSet,
|
|
|
|
@@ -363,7 +363,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
53, 173, 113, 233, 54, 61)),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(1, 25, 13, 38, 2, 9, 11, 35, 23, 48, 12, 51, 53, 173, 113, 233, 54, 61),
|
|
|
|
|
pod: makePod("12000m", "12000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeCcontainer5", "12000m", "12000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(1, 25, 13, 38, 11, 35, 23, 48, 53, 173, 113, 233),
|
|
|
|
@@ -380,7 +380,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: largeTopoSock1CPUSet.Union(cpuset.NewCPUSet(10, 34, 22, 47, 53, 173, 61, 181, 108, 228,
|
|
|
|
|
115, 235)),
|
|
|
|
|
pod: makePod("76000m", "76000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "76000m", "76000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: largeTopoSock1CPUSet.Union(cpuset.NewCPUSet(10, 34, 22, 47)),
|
|
|
|
@@ -395,7 +395,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": largeTopoCPUSet.Difference(cpuset.NewCPUSet(10, 11, 53, 37, 55, 67, 52)),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(10, 11, 53, 67, 52),
|
|
|
|
|
pod: makePod("5000m", "5000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "5000m", "5000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(10, 11, 53, 67, 52),
|
|
|
|
@@ -411,7 +411,7 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
|
|
|
"fakeID100": largeTopoCPUSet.Difference(cpuset.NewCPUSet(10, 11, 53, 37, 55, 67, 52)),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(10, 11, 53, 37, 55, 67, 52),
|
|
|
|
|
pod: makePod("76000m", "76000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer5", "76000m", "76000m"),
|
|
|
|
|
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -704,7 +704,7 @@ func TestStaticPolicyAddWithResvList(t *testing.T) {
|
|
|
|
|
containerID: "fakeID2",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("8000m", "8000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
|
|
|
|
|
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
|
|
|
|
|
expCPUAlloc: false,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(),
|
|
|
|
@@ -717,7 +717,7 @@ func TestStaticPolicyAddWithResvList(t *testing.T) {
|
|
|
|
|
containerID: "fakeID2",
|
|
|
|
|
stAssignments: state.ContainerCPUAssignments{},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 2, 3, 4, 5, 6, 7),
|
|
|
|
|
pod: makePod("1000m", "1000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer2", "1000m", "1000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(4), // expect sibling of partial core
|
|
|
|
@@ -732,7 +732,7 @@ func TestStaticPolicyAddWithResvList(t *testing.T) {
|
|
|
|
|
"fakeID100": cpuset.NewCPUSet(2, 3, 6, 7),
|
|
|
|
|
},
|
|
|
|
|
stDefaultCPUSet: cpuset.NewCPUSet(0, 1, 4, 5),
|
|
|
|
|
pod: makePod("2000m", "2000m"),
|
|
|
|
|
pod: makePod("fakePod", "fakeContainer3", "2000m", "2000m"),
|
|
|
|
|
expErr: nil,
|
|
|
|
|
expCPUAlloc: true,
|
|
|
|
|
expCSet: cpuset.NewCPUSet(4, 5),
|
|
|
|
|