-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: add tests for topology-aware mixed CPU allocations
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
test/e2e/policies.test-suite/topology-aware/n4c16/test07-mixed-allocations/code.var.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 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 not have exclusive CPUs` \ | ||
"len(cpus['pod2c1']) == 4" \ | ||
"len(cpus['pod2c1'] - cpus['pod0c0'] - cpus['pod0c1'] - cpus['pod1c0'] - cpus['pod1c1'] - cpus['pod2c0']) == 0" | ||
|
||
# TODO: | ||
# - test opt-out 1500m CPU exclusive allocation | ||
# - test opt-in 2500m CPU exclusive allocation |