Skip AppArmor tests on unsupported distros

This commit is contained in:
Kris 2017-03-15 14:59:23 -07:00
parent c0ecd93801
commit 3d05080982
2 changed files with 18 additions and 2 deletions

View File

@ -32,8 +32,11 @@ const (
appArmorDeniedPath = "/expect_permission_denied"
)
// AppArmorDistros are distros with AppArmor support
var AppArmorDistros = []string{"gci", "ubuntu"}
func SkipIfAppArmorNotSupported() {
framework.SkipUnlessNodeOSDistroIs("gci", "ubuntu")
framework.SkipUnlessNodeOSDistroIs(AppArmorDistros...)
}
func LoadAppArmorProfiles(f *framework.Framework) {

View File

@ -34,9 +34,22 @@ type AppArmorUpgradeTest struct {
func (AppArmorUpgradeTest) Name() string { return "apparmor-upgrade" }
func (AppArmorUpgradeTest) Skip(upgCtx UpgradeContext) bool {
var supportedImages map[string]bool
for _, d := range common.AppArmorDistros {
supportedImages[d] = true
}
for _, vCtx := range upgCtx.Versions {
if !supportedImages[vCtx.NodeImage] {
return true
}
}
return false
}
// Setup creates a secret and then verifies that a pod can consume it.
func (t *AppArmorUpgradeTest) Setup(f *framework.Framework) {
common.SkipIfAppArmorNotSupported()
By("Loading AppArmor profiles to nodes")
common.LoadAppArmorProfiles(f)