@@ -23,68 +23,6 @@ import (
23
23
"k8s.io/api/core/v1"
24
24
)
25
25
26
- func TestParseSELinuxOptions (t * testing.T ) {
27
- cases := []struct {
28
- name string
29
- input string
30
- expected * v1.SELinuxOptions
31
- }{
32
- {
33
- name : "simple" ,
34
- input : "user_t:role_t:type_t:s0" ,
35
- expected : & v1.SELinuxOptions {
36
- User : "user_t" ,
37
- Role : "role_t" ,
38
- Type : "type_t" ,
39
- Level : "s0" ,
40
- },
41
- },
42
- {
43
- name : "simple + categories" ,
44
- input : "user_t:role_t:type_t:s0:c0" ,
45
- expected : & v1.SELinuxOptions {
46
- User : "user_t" ,
47
- Role : "role_t" ,
48
- Type : "type_t" ,
49
- Level : "s0:c0" ,
50
- },
51
- },
52
- {
53
- name : "not enough fields" ,
54
- input : "type_t:s0:c0" ,
55
- },
56
- }
57
-
58
- for _ , tc := range cases {
59
- result , err := ParseSELinuxOptions (tc .input )
60
-
61
- if err != nil {
62
- if tc .expected == nil {
63
- continue
64
- } else {
65
- t .Errorf ("%v: unexpected error: %v" , tc .name , err )
66
- }
67
- }
68
-
69
- compareContexts (tc .name , tc .expected , result , t )
70
- }
71
- }
72
-
73
- func compareContexts (name string , ex , ac * v1.SELinuxOptions , t * testing.T ) {
74
- if e , a := ex .User , ac .User ; e != a {
75
- t .Errorf ("%v: expected user: %v, got: %v" , name , e , a )
76
- }
77
- if e , a := ex .Role , ac .Role ; e != a {
78
- t .Errorf ("%v: expected role: %v, got: %v" , name , e , a )
79
- }
80
- if e , a := ex .Type , ac .Type ; e != a {
81
- t .Errorf ("%v: expected type: %v, got: %v" , name , e , a )
82
- }
83
- if e , a := ex .Level , ac .Level ; e != a {
84
- t .Errorf ("%v: expected level: %v, got: %v" , name , e , a )
85
- }
86
- }
87
-
88
26
func TestAddNoNewPrivileges (t * testing.T ) {
89
27
pfalse := false
90
28
ptrue := true
0 commit comments