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 удалений

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

@@ -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",