Skip to content

Commit 268aea6

Browse files
committed
admission_test.go(TestAdmitSuccess): remove hardcoded SELinux level.
1 parent 0016ceb commit 268aea6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/security/admission/admission_test.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,13 @@ func testSCCAdmit(testCaseName string, sccs []*securityapi.SecurityContextConstr
173173
}
174174

175175
func TestAdmitSuccess(t *testing.T) {
176-
tc := setupClientSet()
176+
// create the annotated namespace and add it to the fake client
177+
namespace := admissiontesting.CreateNamespaceForTest()
178+
179+
serviceAccount := admissiontesting.CreateSAForTest()
180+
serviceAccount.Namespace = namespace.Name
181+
182+
tc := clientsetfake.NewSimpleClientset(namespace, serviceAccount)
177183

178184
// used for cases where things are preallocated
179185
defaultGroup := int64(2)
@@ -223,8 +229,7 @@ func TestAdmitSuccess(t *testing.T) {
223229
Level: "s0:c1,c0",
224230
}
225231

226-
// level matches a value from namespace (see CreateNamespaceForTest())
227-
seLinuxLevelFromNamespace := "s0:c1,c0"
232+
seLinuxLevelFromNamespace := namespace.Annotations[allocator.MCSAnnotation]
228233

229234
testCases := map[string]struct {
230235
pod *kapi.Pod

0 commit comments

Comments
 (0)