mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 03:38:15 +00:00
csr: add resync to csr approver
This commit is contained in:
@@ -89,6 +89,7 @@ func TestHandle(t *testing.T) {
|
||||
message string
|
||||
allowed bool
|
||||
recognized bool
|
||||
err bool
|
||||
verify func(*testing.T, []testclient.Action)
|
||||
}{
|
||||
{
|
||||
@@ -119,6 +120,7 @@ func TestHandle(t *testing.T) {
|
||||
}
|
||||
_ = as[0].(testclient.CreateActionImpl)
|
||||
},
|
||||
err: true,
|
||||
},
|
||||
{
|
||||
recognized: true,
|
||||
@@ -155,7 +157,7 @@ func TestHandle(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
t.Run(fmt.Sprintf("recognized:%v,allowed: %v", c.recognized, c.allowed), func(t *testing.T) {
|
||||
t.Run(fmt.Sprintf("recognized:%v,allowed: %v,err: %v", c.recognized, c.allowed, c.err), func(t *testing.T) {
|
||||
client := &fake.Clientset{}
|
||||
client.AddReactor("create", "subjectaccessreviews", func(action testclient.Action) (handled bool, ret runtime.Object, err error) {
|
||||
return true, &authorization.SubjectAccessReview{
|
||||
@@ -177,7 +179,7 @@ func TestHandle(t *testing.T) {
|
||||
},
|
||||
}
|
||||
csr := makeTestCsr()
|
||||
if err := approver.handle(csr); err != nil {
|
||||
if err := approver.handle(csr); err != nil && !c.err {
|
||||
t.Errorf("unexpected err: %v", err)
|
||||
}
|
||||
c.verify(t, client.Actions())
|
||||
|
||||
Reference in New Issue
Block a user