@@ -1070,15 +1070,15 @@ func TestNotifications(t *testing.T) {
1070
1070
1071
1071
// Setup template with dormancy and create a workspace with it
1072
1072
var (
1073
- ticker = make (chan time.Time )
1074
- statCh = make (chan autobuild.Stats )
1075
- notificationsEnqueuer = testutil.FakeNotificationsEnqueuer {}
1076
- timeTilDormant = time .Minute
1077
- client = coderdtest .New (t , & coderdtest.Options {
1073
+ ticker = make (chan time.Time )
1074
+ statCh = make (chan autobuild.Stats )
1075
+ notifyEnq = testutil.FakeNotificationsEnqueuer {}
1076
+ timeTilDormant = time .Minute
1077
+ client = coderdtest .New (t , & coderdtest.Options {
1078
1078
AutobuildTicker : ticker ,
1079
1079
AutobuildStats : statCh ,
1080
1080
IncludeProvisionerDaemon : true ,
1081
- NotificationsEnqueuer : & notificationsEnqueuer ,
1081
+ NotificationsEnqueuer : & notifyEnq ,
1082
1082
TemplateScheduleStore : schedule.MockTemplateScheduleStore {
1083
1083
GetFn : func (_ context.Context , _ database.Store , _ uuid.UUID ) (schedule.TemplateScheduleOptions , error ) {
1084
1084
return schedule.TemplateScheduleOptions {
@@ -1112,6 +1112,15 @@ func TestNotifications(t *testing.T) {
1112
1112
// Check that the workspace is dormant
1113
1113
workspace = coderdtest .MustWorkspace (t , client , workspace .ID )
1114
1114
require .NotNil (t , workspace .DormantAt )
1115
+
1116
+ // Check that a notification was enqueued
1117
+ require .Len (t , notifyEnq .Sent , 1 )
1118
+ require .Equal (t , notifyEnq .Sent [0 ].UserID , workspace .OwnerID )
1119
+ require .Contains (t , notifyEnq .Sent [0 ].Targets , template .ID )
1120
+ require .Contains (t , notifyEnq .Sent [0 ].Targets , workspace .ID )
1121
+ require .Contains (t , notifyEnq .Sent [0 ].Targets , workspace .OrganizationID )
1122
+ require .Contains (t , notifyEnq .Sent [0 ].Targets , workspace .OwnerID )
1123
+ require .Equal (t , notifyEnq .Sent [0 ].Labels ["initiator" ], "autobuild" )
1115
1124
})
1116
1125
}
1117
1126
0 commit comments