@@ -302,23 +302,15 @@ func TestAuthorizationResolution(t *testing.T) {
302
302
t .Fatalf ("unexpected error: %v" , err )
303
303
}
304
304
305
- // try to add Valerie to a non-existent role, looping until it is true due to
306
- // the policy cache taking time to react
307
- if err := wait .Poll (time .Second , 2 * time .Minute , func () (bool , error ) {
308
- err := addValerie .AddRole ()
309
- if err == nil || kapierror .IsNotFound (err ) { // TODO what does this mean?
310
- return true , nil
311
- }
312
- return false , err
313
- }); err != nil {
305
+ if err := addValerie .AddRole (); err != nil {
314
306
t .Fatalf ("unexpected error: %v" , err )
315
307
}
316
308
317
309
roleWithGroup := & authorizationapi.ClusterRole {}
318
310
roleWithGroup .Name = "with-group"
319
311
roleWithGroup .Rules = append (roleWithGroup .Rules , authorizationapi.PolicyRule {
320
312
Verbs : sets .NewString ("list" ),
321
- Resources : sets .NewString ("builds" ), // TODO we may need to track these down
313
+ Resources : sets .NewString ("builds" ),
322
314
})
323
315
if _ , err := clusterAdminClient .ClusterRoles ().Create (roleWithGroup ); err != nil {
324
316
t .Fatalf ("unexpected error: %v" , err )
@@ -1655,46 +1647,3 @@ func TestClusterPolicyCache(t *testing.T) {
1655
1647
}
1656
1648
}
1657
1649
}
1658
-
1659
- // TestPolicyCache confirms that the creation of role bindings fallback to live lookups when the referenced role is not cached
1660
- func TestPolicyCache (t * testing.T ) {
1661
- masterConfig , clusterAdminKubeConfig , err := testserver .StartTestMasterAPI ()
1662
- if err != nil {
1663
- t .Fatalf ("unexpected error: %v" , err )
1664
- }
1665
- defer testserver .CleanupMasterEtcd (t , masterConfig )
1666
-
1667
- clusterAdminClient , err := testutil .GetClusterAdminClient (clusterAdminKubeConfig )
1668
- if err != nil {
1669
- t .Fatalf ("unexpected error: %v" , err )
1670
- }
1671
-
1672
- clusterAdminClientConfig , err := testutil .GetClusterAdminClientConfig (clusterAdminKubeConfig )
1673
- if err != nil {
1674
- t .Fatalf ("unexpected error: %v" , err )
1675
- }
1676
-
1677
- user := "harold"
1678
- namespace := "hammer-project"
1679
-
1680
- haroldClient , err := testserver .CreateNewProject (clusterAdminClient , * clusterAdminClientConfig , namespace , user )
1681
- if err != nil {
1682
- t .Fatalf ("unexpected error: %v" , err )
1683
- }
1684
- haroldClient .RESTClient .Throttle = flowcontrol .NewFakeAlwaysRateLimiter () // turn off rate limiting so cache misses are more likely
1685
-
1686
- for i := 0 ; i < 100 ; i ++ { // usually takes less than 60 attempts for this to cache miss
1687
- role := & authorizationapi.Role {ObjectMeta : metav1.ObjectMeta {GenerateName : time .Now ().String ()}}
1688
- role , err = haroldClient .Roles (namespace ).Create (role )
1689
- if err != nil {
1690
- t .Fatalf ("unexpected error creating role %q: %v" , role .Name , err )
1691
- }
1692
- roleBinding := & authorizationapi.RoleBinding {
1693
- ObjectMeta : metav1.ObjectMeta {Name : role .Name },
1694
- Subjects : []kapi.ObjectReference {{Name : user , Kind : authorizationapi .UserKind }},
1695
- RoleRef : kapi.ObjectReference {Name : role .Name , Namespace : namespace }}
1696
- if _ , err := haroldClient .RoleBindings (namespace ).Create (roleBinding ); err != nil {
1697
- t .Fatalf ("cache error creating role binding %d %q: %v" , i , roleBinding .Name , err )
1698
- }
1699
- }
1700
- }
0 commit comments