@@ -2014,10 +2014,10 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
2014
2014
2015
2015
_ ,_ = fmt .Fprintln (inv .Stderr ,"Creating users..." )
2016
2016
2017
- ownerDialBarrier := & sync.WaitGroup {}
2018
- regularDialBarrier := & sync.WaitGroup {}
2019
- ownerDialBarrier .Add (int (ownerUserCount ))
2020
- regularDialBarrier .Add (int (regularUserCount ))
2017
+ dialBarrier := & sync.WaitGroup {}
2018
+ ownerWatchBarrier := & sync.WaitGroup {}
2019
+ dialBarrier .Add (int (userCount ))
2020
+ ownerWatchBarrier .Add (int (ownerUserCount ))
2021
2021
2022
2022
expectedNotifications := map [uuid.UUID ]chan time.Time {
2023
2023
notificationsLib .TemplateUserAccountCreated :make (chan time.Time ,1 ),
@@ -2030,10 +2030,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
2030
2030
User : createusers.Config {
2031
2031
OrganizationID :me .OrganizationIDs [0 ],
2032
2032
},
2033
- IsOwner :true ,
2033
+ Roles : [] string { codersdk . RoleOwner } ,
2034
2034
NotificationTimeout :notificationTimeout ,
2035
2035
DialTimeout :dialTimeout ,
2036
- DialBarrier :ownerDialBarrier ,
2036
+ DialBarrier :dialBarrier ,
2037
+ OwnerWatchBarrier :ownerWatchBarrier ,
2037
2038
ExpectedNotifications :expectedNotifications ,
2038
2039
Metrics :metrics ,
2039
2040
}
@@ -2047,11 +2048,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
2047
2048
User : createusers.Config {
2048
2049
OrganizationID :me .OrganizationIDs [0 ],
2049
2050
},
2050
- IsOwner :false ,
2051
+ Roles : [] string {} ,
2051
2052
NotificationTimeout :notificationTimeout ,
2052
2053
DialTimeout :dialTimeout ,
2053
- DialBarrier :regularDialBarrier ,
2054
- OwnerDialBarrier :ownerDialBarrier ,
2054
+ DialBarrier :dialBarrier ,
2055
+ OwnerWatchBarrier :ownerWatchBarrier ,
2055
2056
Metrics :metrics ,
2056
2057
}
2057
2058
if err := config .Validate ();err != nil {
@@ -2065,8 +2066,7 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
2065
2066
logger ,
2066
2067
client ,
2067
2068
me .OrganizationIDs [0 ],
2068
- ownerDialBarrier ,
2069
- regularDialBarrier ,
2069
+ dialBarrier ,
2070
2070
dialTimeout ,
2071
2071
expectedNotifications ,
2072
2072
)
@@ -2380,60 +2380,34 @@ func triggerUserNotifications(
2380
2380
logger slog.Logger ,
2381
2381
client * codersdk.Client ,
2382
2382
orgID uuid.UUID ,
2383
- ownerDialBarrier * sync.WaitGroup ,
2384
- regularDialBarrier * sync.WaitGroup ,
2383
+ dialBarrier * sync.WaitGroup ,
2385
2384
dialTimeout time.Duration ,
2386
2385
expectedNotifications map [uuid.UUID ]chan time.Time ,
2387
2386
) {
2388
- logger .Info (ctx ,"waiting forowner users to connect" )
2387
+ logger .Info (ctx ,"waiting forall users to connect" )
2389
2388
2390
- // Wait forowner users to connect
2391
- ownerWaitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2389
+ // Wait forall users to connect
2390
+ waitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2392
2391
defer cancel ()
2393
2392
2394
- ownerDone := make (chan struct {})
2393
+ done := make (chan struct {})
2395
2394
go func () {
2396
- ownerDialBarrier .Wait ()
2397
- close (ownerDone )
2395
+ dialBarrier .Wait ()
2396
+ close (done )
2398
2397
}()
2399
2398
2400
2399
select {
2401
- case <- ownerDone :
2402
- logger .Info (ctx ,"allowner users connected" )
2403
- case <- ownerWaitCtx .Done ():
2404
- if ownerWaitCtx .Err ()== context .DeadlineExceeded {
2405
- logger .Error (ctx ,"timeout waiting forowner users to connect" )
2400
+ case <- done :
2401
+ logger .Info (ctx ,"all users connected" )
2402
+ case <- waitCtx .Done ():
2403
+ if waitCtx .Err ()== context .DeadlineExceeded {
2404
+ logger .Error (ctx ,"timeout waiting for users to connect" )
2406
2405
}else {
2407
- logger .Info (ctx ,"context canceled while waiting forowner users" )
2406
+ logger .Info (ctx ,"context canceled while waiting for users" )
2408
2407
}
2409
2408
return
2410
2409
}
2411
2410
2412
- // Wait for regular users to connect
2413
- logger .Info (ctx ,"waiting for regular users to connect" )
2414
- regularWaitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2415
- defer cancel ()
2416
-
2417
- regularDone := make (chan struct {})
2418
- go func () {
2419
- regularDialBarrier .Wait ()
2420
- close (regularDone )
2421
- }()
2422
-
2423
- select {
2424
- case <- regularDone :
2425
- logger .Info (ctx ,"all regular users connected" )
2426
- case <- regularWaitCtx .Done ():
2427
- if regularWaitCtx .Err ()== context .DeadlineExceeded {
2428
- logger .Error (ctx ,"timeout waiting for regular users to connect" )
2429
- }else {
2430
- logger .Info (ctx ,"context canceled while waiting for regular users" )
2431
- }
2432
- return
2433
- }
2434
-
2435
- logger .Info (ctx ,"all users connected, triggering notifications" )
2436
-
2437
2411
const (
2438
2412
triggerUsername = "scaletest-trigger-user"
2439
2413
triggerEmail = "scaletest-trigger@example.com"