From 07777f5ff9e0bde26abd0288164e5f73b6da992a Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Oct 2017 13:09:41 -0700 Subject: Fix races / finally remove global app for good (#7570) * finally remove global app for good * test compilation fixes * fix races * fix deadlock * wake up write pump so it doesn't take forever to clean up --- app/notification_test.go | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'app/notification_test.go') diff --git a/app/notification_test.go b/app/notification_test.go index 28c931d1f..f5224e84e 100644 --- a/app/notification_test.go +++ b/app/notification_test.go @@ -13,6 +13,7 @@ import ( func TestSendNotifications(t *testing.T) { th := Setup().InitBasic() + defer th.TearDown() th.App.AddUserToChannel(th.BasicUser2, th.BasicChannel) @@ -408,7 +409,9 @@ func TestRemoveCodeFromMessage(t *testing.T) { } func TestGetMentionKeywords(t *testing.T) { - Setup() + th := Setup() + defer th.TearDown() + // user with username or custom mentions enabled user1 := &model.User{ Id: model.NewId(), @@ -856,7 +859,9 @@ func TestDoesStatusAllowPushNotification(t *testing.T) { } func TestGetDirectMessageNotificationEmailSubject(t *testing.T) { - Setup() + th := Setup() + defer th.TearDown() + expectedPrefix := "[http://localhost:8065] New Direct Message from sender on" post := &model.Post{ CreateAt: 1501804801000, @@ -869,7 +874,9 @@ func TestGetDirectMessageNotificationEmailSubject(t *testing.T) { } func TestGetNotificationEmailSubject(t *testing.T) { - Setup() + th := Setup() + defer th.TearDown() + expectedPrefix := "[http://localhost:8065] Notification in team on" post := &model.Post{ CreateAt: 1501804801000, @@ -883,6 +890,8 @@ func TestGetNotificationEmailSubject(t *testing.T) { func TestGetNotificationEmailBodyFullNotificationPublicChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -917,6 +926,8 @@ func TestGetNotificationEmailBodyFullNotificationPublicChannel(t *testing.T) { func TestGetNotificationEmailBodyFullNotificationGroupChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -951,6 +962,8 @@ func TestGetNotificationEmailBodyFullNotificationGroupChannel(t *testing.T) { func TestGetNotificationEmailBodyFullNotificationPrivateChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -985,6 +998,8 @@ func TestGetNotificationEmailBodyFullNotificationPrivateChannel(t *testing.T) { func TestGetNotificationEmailBodyFullNotificationDirectChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -1017,6 +1032,8 @@ func TestGetNotificationEmailBodyFullNotificationDirectChannel(t *testing.T) { // from here func TestGetNotificationEmailBodyGenericNotificationPublicChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -1048,6 +1065,8 @@ func TestGetNotificationEmailBodyGenericNotificationPublicChannel(t *testing.T) func TestGetNotificationEmailBodyGenericNotificationGroupChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -1079,6 +1098,8 @@ func TestGetNotificationEmailBodyGenericNotificationGroupChannel(t *testing.T) { func TestGetNotificationEmailBodyGenericNotificationPrivateChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", @@ -1110,6 +1131,8 @@ func TestGetNotificationEmailBodyGenericNotificationPrivateChannel(t *testing.T) func TestGetNotificationEmailBodyGenericNotificationDirectChannel(t *testing.T) { th := Setup() + defer th.TearDown() + recipient := &model.User{} post := &model.Post{ Message: "This is the message", -- cgit v1.2.3-1-g7c22