diff --git a/test/e2e/common/apparmor.go b/test/e2e/common/apparmor.go index 914f0daf8cf..68906cf70b8 100644 --- a/test/e2e/common/apparmor.go +++ b/test/e2e/common/apparmor.go @@ -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) { diff --git a/test/e2e/upgrades/apparmor.go b/test/e2e/upgrades/apparmor.go index 44cf56aba71..fe8fdc689eb 100644 --- a/test/e2e/upgrades/apparmor.go +++ b/test/e2e/upgrades/apparmor.go @@ -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)