From 2acbc77d78456d7ba76ceb687b18985d7d92f814 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Fri, 27 Apr 2018 10:38:40 -0700 Subject: MM-10375 Fixing connected socket count (#8682) * Fixing connected socket count * Adding unit test --- api4/system_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'api4/system_test.go') diff --git a/api4/system_test.go b/api4/system_test.go index f74d91563..b12421e62 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -534,6 +534,28 @@ func TestGetAnalyticsOld(t *testing.T) { _, resp = th.SystemAdminClient.GetAnalyticsOld("", th.BasicTeam.Id) CheckNoError(t, resp) + rows2, resp2 := th.SystemAdminClient.GetAnalyticsOld("standard", "") + CheckNoError(t, resp2) + assert.Equal(t, "total_websocket_connections", rows2[5].Name) + assert.Equal(t, float64(0), rows2[5].Value) + + WebSocketClient, err := th.CreateWebSocketClient() + if err != nil { + t.Fatal(err) + } + + rows2, resp2 = th.SystemAdminClient.GetAnalyticsOld("standard", "") + CheckNoError(t, resp2) + assert.Equal(t, "total_websocket_connections", rows2[5].Name) + assert.Equal(t, float64(1), rows2[5].Value) + + WebSocketClient.Close() + + rows2, resp2 = th.SystemAdminClient.GetAnalyticsOld("standard", "") + CheckNoError(t, resp2) + assert.Equal(t, "total_websocket_connections", rows2[5].Name) + assert.Equal(t, float64(0), rows2[5].Value) + Client.Logout() _, resp = Client.GetAnalyticsOld("", th.BasicTeam.Id) CheckUnauthorizedStatus(t, resp) -- cgit v1.2.3-1-g7c22 From 686c2fbab7607d42183ae685a27ea3d7dce8c3f6 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Fri, 27 Apr 2018 12:49:45 -0700 Subject: Structured logging (#8673) * Implementing structured logging * Changes to en.json to allow refactor to run. * Fixing global logger * Structured logger initalization. * Add caller. * Do some log redirection. * Auto refactor * Cleaning up l4g reference and removing dependancy. * Removing junk. * Copyright headers. * Fixing tests * Revert "Changes to en.json to allow refactor to run." This reverts commit fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable. --- api4/system_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'api4/system_test.go') diff --git a/api4/system_test.go b/api4/system_test.go index b12421e62..c0fde6c39 100644 --- a/api4/system_test.go +++ b/api4/system_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - l4g "github.com/alecthomas/log4go" + "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" "github.com/stretchr/testify/assert" ) @@ -392,7 +392,7 @@ func TestGetLogs(t *testing.T) { Client := th.Client for i := 0; i < 20; i++ { - l4g.Info(i) + mlog.Info(fmt.Sprint(i)) } logs, resp := th.SystemAdminClient.GetLogs(0, 10) -- cgit v1.2.3-1-g7c22