@@ -49,6 +49,11 @@ import (
49
49
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
50
50
)
51
51
52
+ const (
53
+ minSMTLevel = 2
54
+ minCPUCapacity = 2
55
+ )
56
+
52
57
// Helper for makeCPUManagerPod().
53
58
type ctnAttribute struct {
54
59
ctnName string
@@ -880,9 +885,9 @@ func runCPUManagerTests(f *framework.Framework) {
880
885
ginkgo .It ("should assign CPUs as expected based on the Pod spec" , func (ctx context.Context ) {
881
886
cpuCap , cpuAlloc , _ = getLocalNodeCPUDetails (ctx , f )
882
887
883
- // Skip CPU Manager tests altogether if the CPU capacity < 2 .
884
- if cpuCap < 2 {
885
- e2eskipper .Skipf ("Skipping CPU Manager tests since the CPU capacity < 2" )
888
+ // Skip CPU Manager tests altogether if the CPU capacity < minCPUCapacity .
889
+ if cpuCap < minCPUCapacity {
890
+ e2eskipper .Skipf ("Skipping CPU Manager tests since the CPU capacity < %d" , minCPUCapacity )
886
891
}
887
892
888
893
// Enable CPU Manager in the kubelet.
@@ -925,13 +930,14 @@ func runCPUManagerTests(f *framework.Framework) {
925
930
smtLevel := getSMTLevel ()
926
931
927
932
// strict SMT alignment is trivially verified and granted on non-SMT systems
928
- if smtLevel < 2 {
933
+ if smtLevel < minSMTLevel {
929
934
e2eskipper .Skipf ("Skipping CPU Manager %s tests since SMT disabled" , fullCPUsOnlyOpt )
930
935
}
931
936
932
- // our tests want to allocate a full core, so we need at last 2*2=4 virtual cpus
933
- if cpuAlloc < int64 (smtLevel * 2 ) {
934
- e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < 4" , fullCPUsOnlyOpt )
937
+ // our tests want to allocate a full core, so we need at least 2*2=4 virtual cpus
938
+ minCPUCount := int64 (smtLevel * minCPUCapacity )
939
+ if cpuAlloc < minCPUCount {
940
+ e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < %d" , fullCPUsOnlyOpt , minCPUCount )
935
941
}
936
942
937
943
framework .Logf ("SMT level %d" , smtLevel )
@@ -1075,13 +1081,14 @@ func runCPUManagerTests(f *framework.Framework) {
1075
1081
smtLevel := getSMTLevel ()
1076
1082
1077
1083
// strict SMT alignment is trivially verified and granted on non-SMT systems
1078
- if smtLevel < 2 {
1084
+ if smtLevel < minSMTLevel {
1079
1085
e2eskipper .Skipf ("Skipping CPU Manager %s tests since SMT disabled" , fullCPUsOnlyOpt )
1080
1086
}
1081
1087
1082
- // our tests want to allocate a full core, so we need at last 2*2=4 virtual cpus
1083
- if cpuAlloc < int64 (smtLevel * 2 ) {
1084
- e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < 4" , fullCPUsOnlyOpt )
1088
+ // our tests want to allocate a full core, so we need at least 2*2=4 virtual cpus
1089
+ minCPUCount := int64 (smtLevel * minCPUCapacity )
1090
+ if cpuAlloc < minCPUCount {
1091
+ e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < %d" , fullCPUsOnlyOpt , minCPUCount )
1085
1092
}
1086
1093
1087
1094
framework .Logf ("SMT level %d" , smtLevel )
@@ -1139,13 +1146,14 @@ func runCPUManagerTests(f *framework.Framework) {
1139
1146
framework .Logf ("SMT level %d" , smtLevel )
1140
1147
1141
1148
// strict SMT alignment is trivially verified and granted on non-SMT systems
1142
- if smtLevel < 2 {
1149
+ if smtLevel < minSMTLevel {
1143
1150
e2eskipper .Skipf ("Skipping CPU Manager %s tests since SMT disabled" , fullCPUsOnlyOpt )
1144
1151
}
1145
1152
1146
- // our tests want to allocate a full core, so we need at last 2*2=4 virtual cpus
1147
- if cpuAlloc < int64 (smtLevel * 2 ) {
1148
- e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < 4" , fullCPUsOnlyOpt )
1153
+ // our tests want to allocate a full core, so we need at least 2*2=4 virtual cpus
1154
+ minCPUCount := int64 (smtLevel * minCPUCapacity )
1155
+ if cpuAlloc < minCPUCount {
1156
+ e2eskipper .Skipf ("Skipping CPU Manager %s tests since the CPU capacity < %d" , fullCPUsOnlyOpt , minCPUCount )
1149
1157
}
1150
1158
1151
1159
// this test is intended to be run on a multi-node NUMA system and
0 commit comments