(orgs []uuid.UUID, users []uuid.UUID, size int, opts ...func(object rbac.Object) rbac.Object)
| 263 | } |
| 264 | |
| 265 | func benchmarkSetup(orgs []uuid.UUID, users []uuid.UUID, size int, opts ...func(object rbac.Object) rbac.Object) []rbac.Object { |
| 266 | // Create a "random" but deterministic set of objects. |
| 267 | aclList := map[string][]policy.Action{ |
| 268 | uuid.NewString(): {policy.ActionRead, policy.ActionUpdate}, |
| 269 | uuid.NewString(): {policy.ActionCreate}, |
| 270 | } |
| 271 | objectList := make([]rbac.Object, size) |
| 272 | for i := range objectList { |
| 273 | objectList[i] = rbac.ResourceWorkspace. |
| 274 | WithID(uuid.New()). |
| 275 | InOrg(orgs[i%len(orgs)]). |
| 276 | WithOwner(users[i%len(users)].String()). |
| 277 | WithACLUserList(aclList). |
| 278 | WithGroupACL(aclList) |
| 279 | |
| 280 | for _, opt := range opts { |
| 281 | objectList[i] = opt(objectList[i]) |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | return objectList |
| 286 | } |
| 287 | |
| 288 | // BenchmarkCacher benchmarks the performance of the cacher. |
| 289 | func BenchmarkCacher(b *testing.B) { |
no test coverage detected