MM-26757 Run server tests on non-default port (#15075)

* run server tests on port randomly selected by the kernel
Этот коммит содержится в:
Doug Lauder
2020-07-21 12:18:57 -04:00
коммит произвёл GitHub
родитель 263e5e8945
Коммит 7e59f311a3

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

@@ -15,6 +15,10 @@ import (
"github.com/stretchr/testify/require"
)
const (
UnitTestListeningPort = ":0"
)
type ServerTestHelper struct {
disableConfigWatch bool
interruptChan chan os.Signal
@@ -56,6 +60,9 @@ func TestRunServerSuccess(t *testing.T) {
configStore, err := config.NewMemoryStore()
require.NoError(t, err)
// Use non-default listening port in case another server instance is already running.
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
err = runServer(configStore, th.disableConfigWatch, false, th.interruptChan)
require.NoError(t, err)
}
@@ -104,6 +111,9 @@ func TestRunServerSystemdNotification(t *testing.T) {
configStore, err := config.NewMemoryStore()
require.NoError(t, err)
// Use non-default listening port in case another server instance is already running.
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
// Start and stop the server
err = runServer(configStore, th.disableConfigWatch, false, th.interruptChan)
require.NoError(t, err)
@@ -125,6 +135,9 @@ func TestRunServerNoSystemd(t *testing.T) {
configStore, err := config.NewMemoryStore()
require.NoError(t, err)
// Use non-default listening port in case another server instance is already running.
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
err = runServer(configStore, th.disableConfigWatch, false, th.interruptChan)
require.NoError(t, err)
}