@@ -77,28 +77,32 @@ var _ = g.Describe("[Conformance][templates] templateinstance security tests", f
77
77
editgroup = createGroup (cli , "editgroup" , bootstrappolicy .EditRoleName )
78
78
addUserToGroup (cli , editbygroupuser .Name , editgroup .Name )
79
79
80
- // I think we get flakes when the group cache hasn't yet noticed the
81
- // new group membership made above. Wait until all it looks like
82
- // all the users above have access to the namespace as expected.
83
- err := wait .PollImmediate (time .Second , 30 * time .Second , func () (done bool , err error ) {
84
- for _ , user := range []* userapi.User {adminuser , edituser , editbygroupuser } {
85
- cli .ChangeUser (user .Name )
86
- sar , err := cli .AuthorizationClient ().Authorization ().LocalSubjectAccessReviews (cli .Namespace ()).Create (& authorizationapi.LocalSubjectAccessReview {
87
- Action : authorizationapi.Action {
88
- Verb : "get" ,
89
- Resource : "pods" ,
90
- },
91
- })
92
- if err != nil {
93
- return false , err
94
- }
95
- if ! sar .Allowed {
96
- return false , nil
80
+ /*
81
+ // jminter: commenting this out for now in case it turns out to be superstition
82
+
83
+ // I think we get flakes when the group cache hasn't yet noticed the
84
+ // new group membership made above. Wait until all it looks like
85
+ // all the users above have access to the namespace as expected.
86
+ err := wait.PollImmediate(time.Second, 30*time.Second, func() (done bool, err error) {
87
+ for _, user := range []*userapi.User{adminuser, edituser, editbygroupuser} {
88
+ cli.ChangeUser(user.Name)
89
+ sar, err := cli.AuthorizationClient().Authorization().LocalSubjectAccessReviews(cli.Namespace()).Create(&authorizationapi.LocalSubjectAccessReview{
90
+ Action: authorizationapi.Action{
91
+ Verb: "get",
92
+ Resource: "pods",
93
+ },
94
+ })
95
+ if err != nil {
96
+ return false, err
97
+ }
98
+ if !sar.Allowed {
99
+ return false, nil
100
+ }
97
101
}
98
- }
99
- return true , nil
100
- } )
101
- o . Expect ( err ). NotTo ( o . HaveOccurred ())
102
+ return true, nil
103
+ })
104
+ o.Expect(err).NotTo(o.HaveOccurred() )
105
+ */
102
106
})
103
107
104
108
g .AfterEach (func () {
@@ -273,8 +277,20 @@ var _ = g.Describe("[Conformance][templates] templateinstance security tests", f
273
277
o .Expect (templateinstance .HasCondition (test .expectCondition , kapi .ConditionTrue )).To (o .Equal (true ))
274
278
o .Expect (test .checkOK (test .namespace )).To (o .BeTrue ())
275
279
276
- err = cli .TemplateClient ().Template ().TemplateInstances (cli .Namespace ()).Delete (templateinstance .Name , nil )
280
+ foreground := metav1 .DeletePropagationForeground
281
+ err = cli .TemplateClient ().Template ().TemplateInstances (cli .Namespace ()).Delete (templateinstance .Name , & metav1.DeleteOptions {PropagationPolicy : & foreground })
277
282
o .Expect (err ).NotTo (o .HaveOccurred ())
283
+
284
+ // wait for garbage collector to do its thing
285
+ err = wait .Poll (100 * time .Millisecond , 30 * time .Second , func () (bool , error ) {
286
+ _ , err = cli .TemplateClient ().Template ().TemplateInstances (cli .Namespace ()).Get (templateinstance .Name , metav1.GetOptions {})
287
+ if kerrors .IsNotFound (err ) {
288
+ return true , nil
289
+ }
290
+ return false , err
291
+ })
292
+ o .Expect (err ).NotTo (o .HaveOccurred ())
293
+
278
294
err = cli .KubeClient ().CoreV1 ().Secrets (cli .Namespace ()).Delete (secret .Name , nil )
279
295
o .Expect (err ).NotTo (o .HaveOccurred ())
280
296
}
0 commit comments