mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +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
@ -47,7 +47,6 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
numalignCmd = `export CPULIST_ALLOWED=$( awk -F":\t*" '/Cpus_allowed_list/ { print $2 }' /proc/self/status); env; sleep 1d`
|
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?
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Helper for makeTopologyManagerPod().
|
// Helper for makeTopologyManagerPod().
|
||||||
@ -570,13 +569,18 @@ func runTopologyManagerNegativeTest(f *framework.Framework, numaNodes, numPods i
|
|||||||
if pod.Status.Phase != v1.PodFailed {
|
if pod.Status.Phase != v1.PodFailed {
|
||||||
framework.Failf("pod %s not failed: %v", pod.Name, pod.Status)
|
framework.Failf("pod %s not failed: %v", pod.Name, pod.Status)
|
||||||
}
|
}
|
||||||
if pod.Status.Reason != topologyError {
|
if !isTopologyAffinityError(pod) {
|
||||||
framework.Failf("pod %s failed for wrong reason: %v", pod.Name, pod.Status)
|
framework.Failf("pod %s failed for wrong reason: %q", pod.Name, pod.Status.Reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
deletePods(f, []string{pod.Name})
|
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 {
|
func getSRIOVDevicePluginConfigMap(cmFile string) *v1.ConfigMap {
|
||||||
cmData := testfiles.ReadOrDie(SRIOVDevicePluginCMYAML)
|
cmData := testfiles.ReadOrDie(SRIOVDevicePluginCMYAML)
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user