@@ -723,17 +723,17 @@ func TestDisabledBeforeEnqueue(t *testing.T) {
723
723
user := createSampleUser (t ,db )
724
724
725
725
// WHEN: the user has a preference set to not receive the "workspace deleted" notification
726
- templateId := notifications .TemplateWorkspaceDeleted
726
+ templateID := notifications .TemplateWorkspaceDeleted
727
727
n ,err := db .UpdateUserNotificationPreferences (ctx , database.UpdateUserNotificationPreferencesParams {
728
728
UserID :user .ID ,
729
- NotificationTemplateIds : []uuid.UUID {templateId },
729
+ NotificationTemplateIds : []uuid.UUID {templateID },
730
730
Disableds : []bool {true },
731
731
})
732
732
require .NoError (t ,err ,"failed to set preferences" )
733
733
require .EqualValues (t ,1 ,n ,"unexpected number of affected rows" )
734
734
735
735
// THEN: enqueuing the "workspace deleted" notification should fail with an error
736
- _ ,err = enq .Enqueue (ctx ,user .ID ,templateId ,map [string ]string {},"test" )
736
+ _ ,err = enq .Enqueue (ctx ,user .ID ,templateID ,map [string ]string {},"test" )
737
737
require .ErrorIs (t ,err ,notifications .ErrCannotEnqueueDisabledNotification ,"enqueueing did not fail with expected error" )
738
738
}
739
739
@@ -763,14 +763,14 @@ func TestDisabledAfterEnqueue(t *testing.T) {
763
763
user := createSampleUser (t ,db )
764
764
765
765
// GIVEN: a notification is enqueued which has not (yet) been disabled
766
- templateId := notifications .TemplateWorkspaceDeleted
767
- msgId ,err := enq .Enqueue (ctx ,user .ID ,templateId ,map [string ]string {},"test" )
766
+ templateID := notifications .TemplateWorkspaceDeleted
767
+ msgID ,err := enq .Enqueue (ctx ,user .ID ,templateID ,map [string ]string {},"test" )
768
768
require .NoError (t ,err )
769
769
770
770
// Disable the notification template.
771
771
n ,err := db .UpdateUserNotificationPreferences (ctx , database.UpdateUserNotificationPreferencesParams {
772
772
UserID :user .ID ,
773
- NotificationTemplateIds : []uuid.UUID {templateId },
773
+ NotificationTemplateIds : []uuid.UUID {templateID },
774
774
Disableds : []bool {true },
775
775
})
776
776
require .NoError (t ,err ,"failed to set preferences" )
@@ -787,7 +787,7 @@ func TestDisabledAfterEnqueue(t *testing.T) {
787
787
})
788
788
assert .NoError (ct ,err )
789
789
if assert .Equal (ct ,len (m ),1 ) {
790
- assert .Equal (ct ,m [0 ].ID .String (),msgId .String ())
790
+ assert .Equal (ct ,m [0 ].ID .String (),msgID .String ())
791
791
assert .Contains (ct ,m [0 ].StatusReason .String ,"disabled by user" )
792
792
}
793
793
},testutil .WaitLong ,testutil .IntervalFast ,"did not find the expected inhibited message" )
@@ -836,12 +836,12 @@ func TestCustomNotificationMethod(t *testing.T) {
836
836
837
837
// GIVEN: a notification template which has a method explicitly set
838
838
var (
839
- template = notifications .TemplateWorkspaceDormant
839
+ template = notifications .TemplateWorkspaceDormant
840
840
defaultMethod = database .NotificationMethodSmtp
841
- customMethod = database .NotificationMethodWebhook
841
+ customMethod = database .NotificationMethodWebhook
842
842
)
843
843
out ,err := db .UpdateNotificationTemplateMethodByID (ctx , database.UpdateNotificationTemplateMethodByIDParams {
844
- ID :template ,
844
+ ID :template ,
845
845
Method : database.NullNotificationMethod {NotificationMethod :customMethod ,Valid :true },
846
846
})
847
847
require .NoError (t ,err )
@@ -850,8 +850,8 @@ func TestCustomNotificationMethod(t *testing.T) {
850
850
// GIVEN: a manager configured with multiple dispatch methods
851
851
cfg := defaultNotificationsConfig (defaultMethod )
852
852
cfg .SMTP = codersdk.NotificationsEmailConfig {
853
- From :"danny@coder.com" ,
854
- Hello :"localhost" ,
853
+ From :"danny@coder.com" ,
854
+ Hello :"localhost" ,
855
855
Smarthost : serpent.HostPort {Host :"localhost" ,Port :fmt .Sprintf ("%d" ,mockSMTPSrv .PortNumber ())},
856
856
}
857
857
cfg .Webhook = codersdk.NotificationsWebhookConfig {
@@ -870,6 +870,7 @@ func TestCustomNotificationMethod(t *testing.T) {
870
870
// WHEN: a notification of that template is enqueued, it should be delivered with the configured method - not the default.
871
871
user := createSampleUser (t ,db )
872
872
msgID ,err := enq .Enqueue (ctx ,user .ID ,template ,map [string ]string {},"test" )
873
+ require .NoError (t ,err )
873
874
874
875
// THEN: the notification should be received by the custom dispatch method
875
876
mgr .Run (ctx )