diff --git a/test/e2e/policies.test-suite/topology-aware/n4c16/test07-mixed-allocations/code.var.sh b/test/e2e/policies.test-suite/topology-aware/n4c16/test07-mixed-allocations/code.var.sh new file mode 100644 index 0000000000..83dba6c6a7 --- /dev/null +++ b/test/e2e/policies.test-suite/topology-aware/n4c16/test07-mixed-allocations/code.var.sh @@ -0,0 +1,50 @@ +# Place pod0c0 and pod0c1 to shared pools on separate nodes. +CONTCOUNT=2 CPU=500m create guaranteed +report allowed +verify "len(mems['pod0c0']) == 1" \ + "len(mems['pod0c1']) == 1" \ + "disjoint_sets(mems['pod0c0'], mems['pod0c1'])" \ + "len(cpus['pod0c0']) == 4" \ + "len(cpus['pod0c1']) == 4" \ + "disjoint_sets(cpus['pod0c0'], cpus['pod0c1'])" + +# Place pod1c0 to its own node, there is still one 4-CPU node free. +# Placement of pod1c1 is more interesting: +# - node0 has only 3 CPUs (cpu#0 is reserved) +# - node1, node2 and node3 have containers in their shared pools +# - shared pools with pod0c* containers have more free space than node0 +# => pod1c0 should be place to either of those +# - because pod1c1 should get one exclusive CPU, either of pod0c* +# containers should run in a shared pool missing one CPU. +CONTCOUNT=2 CPU=1500m create guaranteed +report allowed +verify "len(mems['pod0c0']) == 1" \ + "len(mems['pod0c1']) == 1" \ + "len(mems['pod1c0']) == 1" \ + "len(mems['pod1c1']) == 1" \ + "disjoint_sets(mems['pod1c0'], mems['pod1c1'])" \ + "len(cpus['pod0c0']) == 3 or len(cpus['pod0c1']) == 3" \ + "len(cpus['pod0c0']) == 4 or len(cpus['pod0c1']) == 4" \ + "len(cpus['pod1c0']) == 4" \ + "len(cpus['pod1c1']) == 4" \ + `# pod1c1 should have one exclusive CPU` \ + "len(cpus['pod1c1'] - cpus['pod0c0'] - cpus['pod0c1']) == 1" + +# Place pod2c0 to node0, as its shared pool has most free CPU (3). +# Place pod2c1 to the node that has only either pod0c0 or pod0c1, +# the other one of them shares a node with pod1c1. +CONTCOUNT=2 CPU=2400m create guaranteed +report allowed +verify "len(mems['pod0c0']) == 1" \ + "len(mems['pod0c1']) == 1" \ + "len(mems['pod1c0']) == 1" \ + "len(mems['pod1c1']) == 1" \ + "len(mems['pod2c0']) == 1" \ + "len(mems['pod2c1']) == 1" \ + `# pod1c1 should have kept its own exclusive CPU` \ + "len(cpus['pod1c1'] - cpus['pod0c0'] - cpus['pod0c1'] - cpus['pod1c0'] - cpus['pod2c0'] - cpus['pod2c1']) == 1" \ + `# pod2c0 is the only container in node0` \ + "len(cpus['pod2c0']) == 3" \ + "len(cpus['pod2c0'] - cpus['pod0c0'] - cpus['pod0c1'] - cpus['pod1c0'] - cpus['pod1c1'] - cpus['pod2c1']) == 3" \ + `# pod2c1 should have two exclusive CPUs` \ + "len(cpus['pod2c1'] - cpus['pod0c0'] - cpus['pod0c1'] - cpus['pod1c0'] - cpus['pod1c1'] - cpus['pod2c0']) == 2"