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
Этот коммит содержится в:
Chris
2017-10-04 13:09:41 -07:00
коммит произвёл GitHub
родитель dc9b1a1d6a
Коммит 07777f5ff9
23 изменённых файлов: 139 добавлений и 67 удалений

Просмотреть файл

@@ -14,6 +14,7 @@ import (
func TestHandleNewNotifications(t *testing.T) {
th := Setup()
defer th.TearDown()
id1 := model.NewId()
id2 := model.NewId()
@@ -94,6 +95,7 @@ func TestHandleNewNotifications(t *testing.T) {
func TestCheckPendingNotifications(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
job.pendingNotifications[th.BasicUser.Id] = []*batchedNotification{
@@ -201,6 +203,8 @@ func TestCheckPendingNotifications(t *testing.T) {
*/
func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
// bypasses recent user activity check
@@ -237,6 +241,8 @@ func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
*/
func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
// bypasses recent user activity check
@@ -281,6 +287,8 @@ func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
*/
func TestRenderBatchedPostGeneric(t *testing.T) {
th := Setup()
defer th.TearDown()
var post = &model.Post{}
post.Message = "This is the message"
var notification = &batchedNotification{}
@@ -306,6 +314,8 @@ func TestRenderBatchedPostGeneric(t *testing.T) {
*/
func TestRenderBatchedPostFull(t *testing.T) {
th := Setup()
defer th.TearDown()
var post = &model.Post{}
post.Message = "This is the message"
var notification = &batchedNotification{}