Capture better debug logs on AppArmor test failure

parent 7043372d
...@@ -26,13 +26,20 @@ import ( ...@@ -26,13 +26,20 @@ import (
var _ = framework.KubeDescribe("AppArmor", func() { var _ = framework.KubeDescribe("AppArmor", func() {
f := framework.NewDefaultFramework("apparmor") f := framework.NewDefaultFramework("apparmor")
BeforeEach(func() { Context("load AppArmor profiles", func() {
common.SkipIfAppArmorNotSupported() BeforeEach(func() {
common.LoadAppArmorProfiles(f) common.SkipIfAppArmorNotSupported()
}) common.LoadAppArmorProfiles(f)
})
It("should enforce an AppArmor profile", func() { AfterEach(func() {
common.CreateAppArmorTestPod(f, true) if !CurrentGinkgoTestDescription().Failed {
framework.LogFailedContainers(f.ClientSet, f.Namespace.Name, framework.Logf) return
}
framework.LogFailedContainers(f.ClientSet, f.Namespace.Name, framework.Logf)
})
It("should enforce an AppArmor profile", func() {
common.CreateAppArmorTestPod(f, true)
})
}) })
}) })
...@@ -60,6 +60,7 @@ elif ! touch %[2]s; then ...@@ -60,6 +60,7 @@ elif ! touch %[2]s; then
exit 2 exit 2
elif ! grep "%[3]s" /proc/1/attr/current; then elif ! grep "%[3]s" /proc/1/attr/current; then
echo "FAILURE: not running with expected profile %[3]s" echo "FAILURE: not running with expected profile %[3]s"
echo "found: $(cat /proc/1/attr/current)"
exit 3 exit 3
fi`, appArmorDeniedPath, appArmorAllowedPath, appArmorProfilePrefix+f.Namespace.Name) fi`, appArmorDeniedPath, appArmorAllowedPath, appArmorProfilePrefix+f.Namespace.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment