Skip to content

Commit cb9a2c5

Browse files
committed
Fix recursive test
1 parent fa399d6 commit cb9a2c5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

coderd/authzquery/authz_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import (
2727
// as only the first db call will be made. But it is better than nothing.
2828
func TestAuthzQueryRecursive(t *testing.T) {
2929
t.Parallel()
30-
q := authzquery.NewAuthzQuerier(databasefake.New(), &coderdtest.RecordingAuthorizer{})
30+
q := authzquery.NewAuthzQuerier(databasefake.New(), &coderdtest.RecordingAuthorizer{
31+
Wrapped: &coderdtest.FakeAuthorizer{AlwaysReturn: nil},
32+
})
3133
actor := rbac.Subject{
3234
ID: uuid.NewString(),
3335
Roles: rbac.RoleNames{rbac.RoleOwner()},
@@ -46,7 +48,10 @@ func TestAuthzQueryRecursive(t *testing.T) {
4648
if method.Name == "InTx" || method.Name == "Ping" {
4749
continue
4850
}
49-
t.Logf(method.Name, method.Type.NumIn(), len(ins))
51+
// Log the name of the last method, so if there is a panic, it is
52+
// easy to know which method failed.
53+
t.Log(method.Name)
54+
// Call the function. Any infinite recursion will stack overflow.
5055
reflect.ValueOf(q).Method(i).Call(ins)
5156
}
5257
}

0 commit comments

Comments
 (0)