Merge pull request #131334 from natasha41575/fix-cgorup-error-msg

[FG:InPlacePodVerticalScaling] add more error details to the failing cgroup check
This commit is contained in:
Kubernetes Prow Robot
2025-04-24 12:00:41 -07:00
committed by GitHub

View File

@@ -301,12 +301,12 @@ func VerifyCgroupValue(f *framework.Framework, pod *v1.Pod, cName, cgPath string
pod.Namespace, pod.Name, cName, expectedCgValues, cgPath)
cgValue, _, err := ExecCommandInContainerWithFullOutput(f, pod.Name, cName, "/bin/sh", "-c", cmd)
if err != nil {
return fmt.Errorf("failed to find one of the expected cgroup values %q in container cgroup %q: %w", expectedCgValues, cgPath, err)
return fmt.Errorf("failed to read cgroup value %q for container %q: %w", cgPath, cName, err)
}
cgValue = strings.Trim(cgValue, "\n")
if err := framework.Gomega().Expect(cgValue).To(gomega.BeElementOf(expectedCgValues)); err != nil {
return fmt.Errorf("value of cgroup %q for container %q should match one of the expectations: %w", cgPath, cName, err)
return fmt.Errorf("value of cgroup %q for container %q was %q; expected one of %q", cgPath, cName, cgValue, expectedCgValues)
}
return nil