From f3c70a2ed26b021575a3d8032f77de6341af0aba Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Wed, 8 Jan 2020 13:46:50 +0000 Subject: [PATCH] Move IsAppArmorSupported() from e2e framework The function is only used at a single place. This moves it to the place. --- test/e2e/auth/pod_security_policy.go | 7 ++++++- test/e2e/framework/BUILD | 1 - test/e2e/framework/checks.go | 22 ---------------------- 3 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 test/e2e/framework/checks.go diff --git a/test/e2e/auth/pod_security_policy.go b/test/e2e/auth/pod_security_policy.go index f0929f69bde..fb5479d864c 100644 --- a/test/e2e/auth/pod_security_policy.go +++ b/test/e2e/auth/pod_security_policy.go @@ -166,7 +166,7 @@ func testPrivilegedPods(tester func(pod *v1.Pod)) { tester(hostipc) }) - if framework.IsAppArmorSupported() { + if isAppArmorSupported() { ginkgo.By("Running a custom AppArmor profile pod", func() { aa := restrictedPod("apparmor") // Every node is expected to have the docker-default profile. @@ -370,3 +370,8 @@ func restrictedPSP(name string) *policyv1beta1.PodSecurityPolicy { func boolPtr(b bool) *bool { return &b } + +// isAppArmorSupported checks whether the AppArmor is supported by the node OS distro. +func isAppArmorSupported() bool { + return framework.NodeOSDistroIs(framework.AppArmorDistros...) +} diff --git a/test/e2e/framework/BUILD b/test/e2e/framework/BUILD index 1b4f4b965bf..96e8da59bdd 100644 --- a/test/e2e/framework/BUILD +++ b/test/e2e/framework/BUILD @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = [ - "checks.go", "cleanup.go", "exec_util.go", "expect.go", diff --git a/test/e2e/framework/checks.go b/test/e2e/framework/checks.go deleted file mode 100644 index 511ec48e5b9..00000000000 --- a/test/e2e/framework/checks.go +++ /dev/null @@ -1,22 +0,0 @@ -/* -Copyright 2019 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package framework - -// IsAppArmorSupported checks whether the AppArmor is supported by the node OS distro. -func IsAppArmorSupported() bool { - return NodeOSDistroIs(AppArmorDistros...) -}