* bind to localhost:0 for tests

Explicitly bind to `localhost:0` instead of just `:0` to avoid binding to all available interfaces and in turn avoid triggering firewall warnings on MacOS.

* fix Playbooks to use dynamic port

* TestMetrics: handle ipv4 localhost too

* TestMetrics: linting
Этот коммит содержится в:
Jesse Hallam
2023-04-06 09:59:58 -03:00
коммит произвёл GitHub
родитель 7325c38c39
Коммит 4b7f6cb974
10 изменённых файлов: 21 добавлений и 19 удалений

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

@@ -6,6 +6,7 @@ package main
import (
"context"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
@@ -117,7 +118,7 @@ func Setup(t *testing.T) *TestEnvironment {
config := configStore.Get()
// Force plugins to be disabled since we are in product mode
config.PluginSettings.Enable = model.NewBool(false)
config.ServiceSettings.ListenAddress = model.NewString("localhost:9056")
config.ServiceSettings.ListenAddress = model.NewString("localhost:0")
config.TeamSettings.MaxUsersPerTeam = model.NewInt(10000)
config.LocalizationSettings.SetDefaults()
config.SqlSettings = *sqlSettings
@@ -218,7 +219,7 @@ func (e *TestEnvironment) CreateClients() {
require.Nil(e.T, appErr)
e.RegularUserNotInTeam = notInTeam
siteURL := "http://localhost:9056"
siteURL := fmt.Sprintf("http://localhost:%v", e.A.Srv().ListenAddr.Port)
serverAdminClient := model.NewAPIv4Client(siteURL)
_, _, err := serverAdminClient.Login(admin.Email, userPassword)