@@ -1779,10 +1779,10 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
1779
1779
1780
1780
_ ,_ = fmt .Fprintln (inv .Stderr ,"Creating users..." )
1781
1781
1782
- ownerDialBarrier := & sync.WaitGroup {}
1783
- regularDialBarrier := & sync.WaitGroup {}
1784
- ownerDialBarrier .Add (int (ownerUserCount ))
1785
- regularDialBarrier .Add (int (regularUserCount ))
1782
+ dialBarrier := & sync.WaitGroup {}
1783
+ ownerWatchBarrier := & sync.WaitGroup {}
1784
+ dialBarrier .Add (int (userCount ))
1785
+ ownerWatchBarrier .Add (int (ownerUserCount ))
1786
1786
1787
1787
expectedNotifications := map [uuid.UUID ]chan time.Time {
1788
1788
notificationsLib .TemplateUserAccountCreated :make (chan time.Time ,1 ),
@@ -1795,10 +1795,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
1795
1795
User : createusers.Config {
1796
1796
OrganizationID :me .OrganizationIDs [0 ],
1797
1797
},
1798
- IsOwner :true ,
1798
+ Roles : [] string { codersdk . RoleOwner } ,
1799
1799
NotificationTimeout :notificationTimeout ,
1800
1800
DialTimeout :dialTimeout ,
1801
- DialBarrier :ownerDialBarrier ,
1801
+ DialBarrier :dialBarrier ,
1802
+ OwnerWatchBarrier :ownerWatchBarrier ,
1802
1803
ExpectedNotifications :expectedNotifications ,
1803
1804
Metrics :metrics ,
1804
1805
}
@@ -1812,11 +1813,11 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
1812
1813
User : createusers.Config {
1813
1814
OrganizationID :me .OrganizationIDs [0 ],
1814
1815
},
1815
- IsOwner :false ,
1816
+ Roles : [] string {} ,
1816
1817
NotificationTimeout :notificationTimeout ,
1817
1818
DialTimeout :dialTimeout ,
1818
- DialBarrier :regularDialBarrier ,
1819
- OwnerDialBarrier :ownerDialBarrier ,
1819
+ DialBarrier :dialBarrier ,
1820
+ OwnerWatchBarrier :ownerWatchBarrier ,
1820
1821
Metrics :metrics ,
1821
1822
}
1822
1823
if err := config .Validate ();err != nil {
@@ -1830,8 +1831,7 @@ func (r *RootCmd) scaletestNotifications() *serpent.Command {
1830
1831
logger ,
1831
1832
client ,
1832
1833
me .OrganizationIDs [0 ],
1833
- ownerDialBarrier ,
1834
- regularDialBarrier ,
1834
+ dialBarrier ,
1835
1835
dialTimeout ,
1836
1836
expectedNotifications ,
1837
1837
)
@@ -2145,60 +2145,34 @@ func triggerUserNotifications(
2145
2145
logger slog.Logger ,
2146
2146
client * codersdk.Client ,
2147
2147
orgID uuid.UUID ,
2148
- ownerDialBarrier * sync.WaitGroup ,
2149
- regularDialBarrier * sync.WaitGroup ,
2148
+ dialBarrier * sync.WaitGroup ,
2150
2149
dialTimeout time.Duration ,
2151
2150
expectedNotifications map [uuid.UUID ]chan time.Time ,
2152
2151
) {
2153
- logger .Info (ctx ,"waiting forowner users to connect" )
2152
+ logger .Info (ctx ,"waiting forall users to connect" )
2154
2153
2155
- // Wait forowner users to connect
2156
- ownerWaitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2154
+ // Wait forall users to connect
2155
+ waitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2157
2156
defer cancel ()
2158
2157
2159
- ownerDone := make (chan struct {})
2158
+ done := make (chan struct {})
2160
2159
go func () {
2161
- ownerDialBarrier .Wait ()
2162
- close (ownerDone )
2160
+ dialBarrier .Wait ()
2161
+ close (done )
2163
2162
}()
2164
2163
2165
2164
select {
2166
- case <- ownerDone :
2167
- logger .Info (ctx ,"allowner users connected" )
2168
- case <- ownerWaitCtx .Done ():
2169
- if ownerWaitCtx .Err ()== context .DeadlineExceeded {
2170
- logger .Error (ctx ,"timeout waiting forowner users to connect" )
2165
+ case <- done :
2166
+ logger .Info (ctx ,"all users connected" )
2167
+ case <- waitCtx .Done ():
2168
+ if waitCtx .Err ()== context .DeadlineExceeded {
2169
+ logger .Error (ctx ,"timeout waiting for users to connect" )
2171
2170
}else {
2172
- logger .Info (ctx ,"context canceled while waiting forowner users" )
2171
+ logger .Info (ctx ,"context canceled while waiting for users" )
2173
2172
}
2174
2173
return
2175
2174
}
2176
2175
2177
- // Wait for regular users to connect
2178
- logger .Info (ctx ,"waiting for regular users to connect" )
2179
- regularWaitCtx ,cancel := context .WithTimeout (ctx ,dialTimeout + 30 * time .Second )
2180
- defer cancel ()
2181
-
2182
- regularDone := make (chan struct {})
2183
- go func () {
2184
- regularDialBarrier .Wait ()
2185
- close (regularDone )
2186
- }()
2187
-
2188
- select {
2189
- case <- regularDone :
2190
- logger .Info (ctx ,"all regular users connected" )
2191
- case <- regularWaitCtx .Done ():
2192
- if regularWaitCtx .Err ()== context .DeadlineExceeded {
2193
- logger .Error (ctx ,"timeout waiting for regular users to connect" )
2194
- }else {
2195
- logger .Info (ctx ,"context canceled while waiting for regular users" )
2196
- }
2197
- return
2198
- }
2199
-
2200
- logger .Info (ctx ,"all users connected, triggering notifications" )
2201
-
2202
2176
const (
2203
2177
triggerUsername = "scaletest-trigger-user"
2204
2178
triggerEmail = "scaletest-trigger@example.com"