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