mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
e2e: topomgr: better check for AffinityError
Add a helper function to check if a Pod failed admission for Topology Affinity Error. So far we only check the Status.Reason. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
parent
512a4e8a3e
commit
83c344647f
@ -46,8 +46,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
numalignCmd = `export CPULIST_ALLOWED=$( awk -F":\t*" '/Cpus_allowed_list/ { print $2 }' /proc/self/status); env; sleep 1d`
|
||||
topologyError = "Topology Affinity Error" // XXX do we have a proper constant?
|
||||
numalignCmd = `export CPULIST_ALLOWED=$( awk -F":\t*" '/Cpus_allowed_list/ { print $2 }' /proc/self/status); env; sleep 1d`
|
||||
)
|
||||
|
||||
// Helper for makeTopologyManagerPod().
|
||||
@ -570,13 +569,18 @@ func runTopologyManagerNegativeTest(f *framework.Framework, numaNodes, numPods i
|
||||
if pod.Status.Phase != v1.PodFailed {
|
||||
framework.Failf("pod %s not failed: %v", pod.Name, pod.Status)
|
||||
}
|
||||
if pod.Status.Reason != topologyError {
|
||||
framework.Failf("pod %s failed for wrong reason: %v", pod.Name, pod.Status)
|
||||
if !isTopologyAffinityError(pod) {
|
||||
framework.Failf("pod %s failed for wrong reason: %q", pod.Name, pod.Status.Reason)
|
||||
}
|
||||
|
||||
deletePods(f, []string{pod.Name})
|
||||
}
|
||||
|
||||
func isTopologyAffinityError(pod *v1.Pod) bool {
|
||||
re := regexp.MustCompile(`Topology.*Affinity.*Error`)
|
||||
return re.MatchString(pod.Status.Reason)
|
||||
}
|
||||
|
||||
func getSRIOVDevicePluginConfigMap(cmFile string) *v1.ConfigMap {
|
||||
cmData := testfiles.ReadOrDie(SRIOVDevicePluginCMYAML)
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user