From b6f18d3bb05df01a1a57e5b9c3af7b28778e1f0e Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Thu, 7 Apr 2022 20:13:27 +0530 Subject: [PATCH] MM-42880: Fix TestRunServerSuccess (#19910) https://mattermost.atlassian.net/browse/MM-42880 ```release-note NONE ``` --- cmd/mattermost/commands/server_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/mattermost/commands/server_test.go b/cmd/mattermost/commands/server_test.go index a8dfc92477..8d94a4de17 100644 --- a/cmd/mattermost/commands/server_test.go +++ b/cmd/mattermost/commands/server_test.go @@ -17,7 +17,7 @@ import ( ) const ( - UnitTestListeningPort = ":0" + unitTestListeningPort = ":0" ) //nolint:golint,unused @@ -64,7 +64,9 @@ func TestRunServerSuccess(t *testing.T) { configStore := config.NewTestMemoryStore() // Use non-default listening port in case another server instance is already running. - *configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort + cfg := configStore.Get() + *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + configStore.Set(cfg) err := runServer(configStore, th.interruptChan) require.NoError(t, err) @@ -114,7 +116,9 @@ func TestRunServerSystemdNotification(t *testing.T) { configStore := config.NewTestMemoryStore() // Use non-default listening port in case another server instance is already running. - *configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort + cfg := configStore.Get() + *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + configStore.Set(cfg) // Start and stop the server err = runServer(configStore, th.interruptChan) @@ -137,7 +141,9 @@ func TestRunServerNoSystemd(t *testing.T) { configStore := config.NewTestMemoryStore() // Use non-default listening port in case another server instance is already running. - *configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort + cfg := configStore.Get() + *cfg.ServiceSettings.ListenAddress = unitTestListeningPort + configStore.Set(cfg) err := runServer(configStore, th.interruptChan) require.NoError(t, err)