-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add simple tests to verify isolcpus allocation
Signed-off-by: Feruzjon Muyassarov <feruzjon.muyassarov@intel.com>
- Loading branch information
1 parent
867f579
commit 3a68601
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
test/e2e/policies.test-suite/balloons/n4c16/test22-isolcpus/balloons-isolcpus.cfg
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,17 @@ | ||
config: | ||
balloonTypes: | ||
- name: isolcpus | ||
minBalloons: 0 | ||
minCPUs: 1 | ||
minBalloons: 1 | ||
preferIsolCpus: true | ||
namespaces: | ||
- default | ||
instrumentation: | ||
httpEndpoint: :8891 | ||
prometheusExport: true | ||
log: | ||
debug: | ||
- policy | ||
klog: | ||
skip_headers: true |
33 changes: 33 additions & 0 deletions
33
test/e2e/policies.test-suite/balloons/n4c16/test22-isolcpus/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,33 @@ | ||
helm-terminate | ||
helm_config=${TEST_DIR}/balloons-isolcpus.cfg helm-launch balloons | ||
|
||
vm-command "grep isolcpus=0,1 /proc/cmdline" || { | ||
if [ "$distro" = "generic/fedora37" ]; then | ||
fedora-set-kernel-cmdline "isolcpus=0,1" | ||
else | ||
ubuntu-set-kernel-cmdline "isolcpus=0,1" | ||
fi | ||
vm-reboot | ||
vm-command "grep isolcpus=0,1 /proc/cmdline" || { | ||
error "failed to set isolcpus kernel commandline parameter" | ||
} | ||
vm-command "systemctl restart kubelet" | ||
sleep 5 | ||
vm-wait-process --timeout 120 kube-apiserver | ||
} | ||
vm-command "kubectl create namespace isolcpus" | ||
vm-command "kubectl create namespace non-isolcpus" | ||
|
||
# pod0: runs on system isolated CPUs | ||
CONTCOUNT=2 namespace=default create balloons-busybox | ||
report allowed | ||
verify "cpus['pod0c0'] == {'cpu00', 'cpu01'}" | ||
|
||
# pod1: should run on non-isolated CPUs | ||
CONTCOUNT=1 namespace="kube-system" create balloons-busybox | ||
report allowed | ||
verify "cpus['pod1c0'] != {'cpu00', 'cpu01'}" | ||
|
||
cleanup | ||
|
||
helm-terminate |
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