Skip to content

Commit

Permalink
Capture better debug logs on AppArmor test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
tallclair committed May 31, 2017
1 parent 7043372 commit 81c9181
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test/e2e/apparmor.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ import (
var _ = framework.KubeDescribe("AppArmor", func() {
f := framework.NewDefaultFramework("apparmor")

BeforeEach(func() {
common.SkipIfAppArmorNotSupported()
common.LoadAppArmorProfiles(f)
})

It("should enforce an AppArmor profile", func() {
common.CreateAppArmorTestPod(f, true)
framework.LogFailedContainers(f.ClientSet, f.Namespace.Name, framework.Logf)
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)
})
})
})
1 change: 1 addition & 0 deletions test/e2e/common/apparmor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 81c9181

Please sign in to comment.