@@ -465,6 +465,32 @@ func TestPatchGroup(t *testing.T) {
465
465
require .Equal (t , http .StatusBadRequest , cerr .StatusCode ())
466
466
})
467
467
468
+ // For quotas to work with prebuilds, it's currently required to add the
469
+ // prebuilds user into a group with a quota allowance.
470
+ // See: docs/admin/templates/extending-templates/prebuilt-workspaces.md
471
+ t .Run ("PrebuildsUser" , func (t * testing.T ) {
472
+ t .Parallel ()
473
+
474
+ client , user := coderdenttest .New (t , & coderdenttest.Options {LicenseOptions : & coderdenttest.LicenseOptions {
475
+ Features : license.Features {
476
+ codersdk .FeatureTemplateRBAC : 1 ,
477
+ },
478
+ }})
479
+ userAdminClient , _ := coderdtest .CreateAnotherUser (t , client , user .OrganizationID , rbac .RoleUserAdmin ())
480
+ ctx := testutil .Context (t , testutil .WaitLong )
481
+ group , err := userAdminClient .CreateGroup (ctx , user .OrganizationID , codersdk.CreateGroupRequest {
482
+ Name : "prebuilds" ,
483
+ QuotaAllowance : 123 ,
484
+ })
485
+ require .NoError (t , err )
486
+
487
+ group , err = userAdminClient .PatchGroup (ctx , group .ID , codersdk.PatchGroupRequest {
488
+ Name : "prebuilds" ,
489
+ AddUsers : []string {prebuilds .SystemUserID .String ()},
490
+ })
491
+ require .NoError (t , err )
492
+ })
493
+
468
494
t .Run ("Everyone" , func (t * testing.T ) {
469
495
t .Parallel ()
470
496
t .Run ("NoUpdateName" , func (t * testing.T ) {
0 commit comments