mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Capture better debug logs on AppArmor test failure
This commit is contained in:
parent
7043372d05
commit
81c9181995
@ -26,13 +26,20 @@ import (
|
||||
var _ = framework.KubeDescribe("AppArmor", func() {
|
||||
f := framework.NewDefaultFramework("apparmor")
|
||||
|
||||
BeforeEach(func() {
|
||||
common.SkipIfAppArmorNotSupported()
|
||||
common.LoadAppArmorProfiles(f)
|
||||
})
|
||||
Context("load AppArmor profiles", func() {
|
||||
BeforeEach(func() {
|
||||
common.SkipIfAppArmorNotSupported()
|
||||
common.LoadAppArmorProfiles(f)
|
||||
})
|
||||
AfterEach(func() {
|
||||
if !CurrentGinkgoTestDescription().Failed {
|
||||
return
|
||||
}
|
||||
framework.LogFailedContainers(f.ClientSet, f.Namespace.Name, framework.Logf)
|
||||
})
|
||||
|
||||
It("should enforce an AppArmor profile", func() {
|
||||
common.CreateAppArmorTestPod(f, true)
|
||||
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
|
||||
exit 2
|
||||
elif ! grep "%[3]s" /proc/1/attr/current; then
|
||||
echo "FAILURE: not running with expected profile %[3]s"
|
||||
echo "found: $(cat /proc/1/attr/current)"
|
||||
exit 3
|
||||
fi`, appArmorDeniedPath, appArmorAllowedPath, appArmorProfilePrefix+f.Namespace.Name)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user