chore(httpserver): remove name field
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
|||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
||||||
func stringPtr(s string) *string { return &s }
|
|
||||||
func durationPtr(d time.Duration) *time.Duration { return &d }
|
func durationPtr(d time.Duration) *time.Duration { return &d }
|
||||||
|
|
||||||
var _ Logger = (*testLogger)(nil)
|
var _ Logger = (*testLogger)(nil)
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ func (s *Server) Run(ctx context.Context, ready chan<- struct{}, done chan<- str
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s.logger.Warn(s.name + " http server shutting down: " + ctx.Err().Error())
|
s.logger.Warn("http server shutting down: " + ctx.Err().Error())
|
||||||
shutdownCtx, cancel := context.WithTimeout(
|
shutdownCtx, cancel := context.WithTimeout(
|
||||||
context.Background(), s.shutdownTimeout)
|
context.Background(), s.shutdownTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
if err := server.Shutdown(shutdownCtx); err != nil {
|
if err := server.Shutdown(shutdownCtx); err != nil {
|
||||||
s.logger.Error(s.name + " http server failed shutting down within " +
|
s.logger.Error("http server failed shutting down within " +
|
||||||
s.shutdownTimeout.String())
|
s.shutdownTimeout.String())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -47,7 +47,7 @@ func (s *Server) Run(ctx context.Context, ready chan<- struct{}, done chan<- str
|
|||||||
close(s.addressSet)
|
close(s.addressSet)
|
||||||
|
|
||||||
// note: no further write so no need to mutex
|
// note: no further write so no need to mutex
|
||||||
s.logger.Info(s.name + " http server listening on " + s.address)
|
s.logger.Info("http server listening on " + s.address)
|
||||||
close(ready)
|
close(ready)
|
||||||
|
|
||||||
err = server.Serve(listener)
|
err = server.Serve(listener)
|
||||||
|
|||||||
@@ -16,12 +16,11 @@ func Test_Server_Run_success(t *testing.T) {
|
|||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
|
|
||||||
logger := NewMockLogger(ctrl)
|
logger := NewMockLogger(ctrl)
|
||||||
logger.EXPECT().Info(newRegexMatcher("^test http server listening on 127.0.0.1:[1-9][0-9]{0,4}$"))
|
logger.EXPECT().Info(newRegexMatcher("^http server listening on 127.0.0.1:[1-9][0-9]{0,4}$"))
|
||||||
logger.EXPECT().Warn("test http server shutting down: context canceled")
|
logger.EXPECT().Warn("http server shutting down: context canceled")
|
||||||
const shutdownTimeout = 10 * time.Second
|
const shutdownTimeout = 10 * time.Second
|
||||||
|
|
||||||
server := &Server{
|
server := &Server{
|
||||||
name: "test",
|
|
||||||
address: "127.0.0.1:0",
|
address: "127.0.0.1:0",
|
||||||
addressSet: make(chan struct{}),
|
addressSet: make(chan struct{}),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@@ -55,7 +54,6 @@ func Test_Server_Run_failure(t *testing.T) {
|
|||||||
logger.EXPECT().Error("listen tcp: address -1: invalid port")
|
logger.EXPECT().Error("listen tcp: address -1: invalid port")
|
||||||
|
|
||||||
server := &Server{
|
server := &Server{
|
||||||
name: "test",
|
|
||||||
address: "127.0.0.1:-1",
|
address: "127.0.0.1:-1",
|
||||||
addressSet: make(chan struct{}),
|
addressSet: make(chan struct{}),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ type AddressGetter interface {
|
|||||||
// Server is an HTTP server implementation, which uses
|
// Server is an HTTP server implementation, which uses
|
||||||
// the HTTP handler provided.
|
// the HTTP handler provided.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
name string
|
|
||||||
address string
|
address string
|
||||||
addressSet chan struct{}
|
addressSet chan struct{}
|
||||||
handler http.Handler
|
handler http.Handler
|
||||||
@@ -47,7 +46,6 @@ func New(settings Settings) (s *Server, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return &Server{
|
return &Server{
|
||||||
name: *settings.Name,
|
|
||||||
address: settings.Address,
|
address: settings.Address,
|
||||||
addressSet: make(chan struct{}),
|
addressSet: make(chan struct{}),
|
||||||
handler: settings.Handler,
|
handler: settings.Handler,
|
||||||
|
|||||||
@@ -29,14 +29,12 @@ func Test_New(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"filled settings": {
|
"filled settings": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: &Server{
|
expected: &Server{
|
||||||
name: "name",
|
|
||||||
address: ":8001",
|
address: ":8001",
|
||||||
handler: someHandler,
|
handler: someHandler,
|
||||||
logger: someLogger,
|
logger: someLogger,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/qdm12/gluetun/internal/configuration/settings/helpers"
|
"github.com/qdm12/gluetun/internal/configuration/settings/helpers"
|
||||||
@@ -14,9 +13,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
// Name is the server name to use in logs.
|
|
||||||
// It defaults to the empty string.
|
|
||||||
Name *string
|
|
||||||
// Address is the server listening address.
|
// Address is the server listening address.
|
||||||
// It defaults to :8000.
|
// It defaults to :8000.
|
||||||
Address string
|
Address string
|
||||||
@@ -32,7 +28,6 @@ type Settings struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Settings) SetDefaults() {
|
func (s *Settings) SetDefaults() {
|
||||||
s.Name = helpers.DefaultStringPtr(s.Name, "")
|
|
||||||
s.Address = helpers.DefaultString(s.Address, ":8000")
|
s.Address = helpers.DefaultString(s.Address, ":8000")
|
||||||
const defaultShutdownTimeout = 3 * time.Second
|
const defaultShutdownTimeout = 3 * time.Second
|
||||||
s.ShutdownTimeout = helpers.DefaultDuration(s.ShutdownTimeout, defaultShutdownTimeout)
|
s.ShutdownTimeout = helpers.DefaultDuration(s.ShutdownTimeout, defaultShutdownTimeout)
|
||||||
@@ -40,7 +35,6 @@ func (s *Settings) SetDefaults() {
|
|||||||
|
|
||||||
func (s Settings) Copy() Settings {
|
func (s Settings) Copy() Settings {
|
||||||
return Settings{
|
return Settings{
|
||||||
Name: helpers.CopyStringPtr(s.Name),
|
|
||||||
Address: s.Address,
|
Address: s.Address,
|
||||||
Handler: s.Handler,
|
Handler: s.Handler,
|
||||||
Logger: s.Logger,
|
Logger: s.Logger,
|
||||||
@@ -49,7 +43,6 @@ func (s Settings) Copy() Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Settings) MergeWith(other Settings) {
|
func (s *Settings) MergeWith(other Settings) {
|
||||||
s.Name = helpers.MergeWithStringPtr(s.Name, other.Name)
|
|
||||||
s.Address = helpers.MergeWithString(s.Address, other.Address)
|
s.Address = helpers.MergeWithString(s.Address, other.Address)
|
||||||
s.Handler = helpers.MergeWithHTTPHandler(s.Handler, other.Handler)
|
s.Handler = helpers.MergeWithHTTPHandler(s.Handler, other.Handler)
|
||||||
if s.Logger == nil {
|
if s.Logger == nil {
|
||||||
@@ -59,7 +52,6 @@ func (s *Settings) MergeWith(other Settings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Settings) OverrideWith(other Settings) {
|
func (s *Settings) OverrideWith(other Settings) {
|
||||||
s.Name = helpers.OverrideWithStringPtr(s.Name, other.Name)
|
|
||||||
s.Address = helpers.OverrideWithString(s.Address, other.Address)
|
s.Address = helpers.OverrideWithString(s.Address, other.Address)
|
||||||
s.Handler = helpers.OverrideWithHTTPHandler(s.Handler, other.Handler)
|
s.Handler = helpers.OverrideWithHTTPHandler(s.Handler, other.Handler)
|
||||||
if other.Logger != nil {
|
if other.Logger != nil {
|
||||||
@@ -100,7 +92,7 @@ func (s Settings) Validate() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Settings) ToLinesNode() (node *gotree.Node) {
|
func (s Settings) ToLinesNode() (node *gotree.Node) {
|
||||||
node = gotree.New("%s HTTP server settings:", strings.Title(*s.Name))
|
node = gotree.New("HTTP server settings:")
|
||||||
node.Appendf("Listening address: %s", s.Address)
|
node.Appendf("Listening address: %s", s.Address)
|
||||||
node.Appendf("Shutdown timeout: %s", *s.ShutdownTimeout)
|
node.Appendf("Shutdown timeout: %s", *s.ShutdownTimeout)
|
||||||
return node
|
return node
|
||||||
|
|||||||
@@ -21,19 +21,16 @@ func Test_Settings_SetDefaults(t *testing.T) {
|
|||||||
"empty settings": {
|
"empty settings": {
|
||||||
settings: Settings{},
|
settings: Settings{},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr(""),
|
|
||||||
Address: ":8000",
|
Address: ":8000",
|
||||||
ShutdownTimeout: durationPtr(defaultTimeout),
|
ShutdownTimeout: durationPtr(defaultTimeout),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"filled settings": {
|
"filled settings": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -65,14 +62,12 @@ func Test_Settings_Copy(t *testing.T) {
|
|||||||
"empty settings": {},
|
"empty settings": {},
|
||||||
"filled settings": {
|
"filled settings": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -107,14 +102,12 @@ func Test_Settings_MergeWith(t *testing.T) {
|
|||||||
"merge empty with empty": {},
|
"merge empty with empty": {},
|
||||||
"merge empty with filled": {
|
"merge empty with filled": {
|
||||||
other: Settings{
|
other: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -123,14 +116,12 @@ func Test_Settings_MergeWith(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"merge filled with empty": {
|
"merge filled with empty": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -165,14 +156,12 @@ func Test_Settings_OverrideWith(t *testing.T) {
|
|||||||
"override empty with empty": {},
|
"override empty with empty": {},
|
||||||
"override empty with filled": {
|
"override empty with filled": {
|
||||||
other: Settings{
|
other: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -181,14 +170,12 @@ func Test_Settings_OverrideWith(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"override filled with empty": {
|
"override filled with empty": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -197,19 +184,16 @@ func Test_Settings_OverrideWith(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"override filled with filled": {
|
"override filled with filled": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8001",
|
Address: ":8001",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
other: Settings{
|
other: Settings{
|
||||||
Name: stringPtr("name2"),
|
|
||||||
Address: ":8002",
|
Address: ":8002",
|
||||||
ShutdownTimeout: durationPtr(time.Hour),
|
ShutdownTimeout: durationPtr(time.Hour),
|
||||||
},
|
},
|
||||||
expected: Settings{
|
expected: Settings{
|
||||||
Name: stringPtr("name2"),
|
|
||||||
Address: ":8002",
|
Address: ":8002",
|
||||||
Handler: someHandler,
|
Handler: someHandler,
|
||||||
Logger: someLogger,
|
Logger: someLogger,
|
||||||
@@ -307,11 +291,10 @@ func Test_Settings_String(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
"all values": {
|
"all values": {
|
||||||
settings: Settings{
|
settings: Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8000",
|
Address: ":8000",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
s: `Name HTTP server settings:
|
s: `HTTP server settings:
|
||||||
├── Listening address: :8000
|
├── Listening address: :8000
|
||||||
└── Shutdown timeout: 1s`,
|
└── Shutdown timeout: 1s`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func boolPtr(b bool) *bool { return &b }
|
func boolPtr(b bool) *bool { return &b }
|
||||||
func stringPtr(s string) *string { return &s }
|
|
||||||
func durationPtr(d time.Duration) *time.Duration { return &d }
|
func durationPtr(d time.Duration) *time.Duration { return &d }
|
||||||
|
|
||||||
var _ gomock.Matcher = (*regexMatcher)(nil)
|
var _ gomock.Matcher = (*regexMatcher)(nil)
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ func New(settings Settings) (server *httpserver.Server, err error) {
|
|||||||
handler.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
|
handler.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
|
||||||
handler.Handle("/debug/pprof/heap", pprof.Handler("heap"))
|
handler.Handle("/debug/pprof/heap", pprof.Handler("heap"))
|
||||||
handler.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
|
handler.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
|
||||||
|
|
||||||
httpServerName := "pprof"
|
|
||||||
settings.HTTPServer.Name = &httpServerName
|
|
||||||
settings.HTTPServer.Handler = handler
|
settings.HTTPServer.Handler = handler
|
||||||
|
|
||||||
settings.SetDefaults()
|
settings.SetDefaults()
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ func Test_Server(t *testing.T) {
|
|||||||
const address = "127.0.0.1:0"
|
const address = "127.0.0.1:0"
|
||||||
logger := NewMockLogger(ctrl)
|
logger := NewMockLogger(ctrl)
|
||||||
|
|
||||||
logger.EXPECT().Info(newRegexMatcher("^pprof http server listening on 127.0.0.1:[1-9][0-9]{0,4}$"))
|
logger.EXPECT().Info(newRegexMatcher("^http server listening on 127.0.0.1:[1-9][0-9]{0,4}$"))
|
||||||
logger.EXPECT().Warn("pprof http server shutting down: context canceled")
|
logger.EXPECT().Warn("http server shutting down: context canceled")
|
||||||
|
|
||||||
const httpServerShutdownTimeout = 10 * time.Second // 10s in case test worker is slow
|
const httpServerShutdownTimeout = 10 * time.Second // 10s in case test worker is slow
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ type Settings struct {
|
|||||||
|
|
||||||
func (s *Settings) SetDefaults() {
|
func (s *Settings) SetDefaults() {
|
||||||
s.Enabled = helpers.DefaultBool(s.Enabled, false)
|
s.Enabled = helpers.DefaultBool(s.Enabled, false)
|
||||||
s.HTTPServer.Name = helpers.DefaultStringPtr(s.HTTPServer.Name, "pprof")
|
|
||||||
s.HTTPServer.Address = helpers.DefaultString(s.HTTPServer.Address, "localhost:6060")
|
s.HTTPServer.Address = helpers.DefaultString(s.HTTPServer.Address, "localhost:6060")
|
||||||
s.HTTPServer.SetDefaults()
|
s.HTTPServer.SetDefaults()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ func Test_Settings_SetDefaults(t *testing.T) {
|
|||||||
expected: Settings{
|
expected: Settings{
|
||||||
Enabled: boolPtr(false),
|
Enabled: boolPtr(false),
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("pprof"),
|
|
||||||
Address: "localhost:6060",
|
Address: "localhost:6060",
|
||||||
ShutdownTimeout: durationPtr(3 * time.Second),
|
ShutdownTimeout: durationPtr(3 * time.Second),
|
||||||
},
|
},
|
||||||
@@ -33,7 +32,6 @@ func Test_Settings_SetDefaults(t *testing.T) {
|
|||||||
BlockProfileRate: 1,
|
BlockProfileRate: 1,
|
||||||
MutexProfileRate: 1,
|
MutexProfileRate: 1,
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("custom"),
|
|
||||||
Address: ":6061",
|
Address: ":6061",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -43,7 +41,6 @@ func Test_Settings_SetDefaults(t *testing.T) {
|
|||||||
BlockProfileRate: 1,
|
BlockProfileRate: 1,
|
||||||
MutexProfileRate: 1,
|
MutexProfileRate: 1,
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("custom"),
|
|
||||||
Address: ":6061",
|
Address: ":6061",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -77,7 +74,6 @@ func Test_Settings_Copy(t *testing.T) {
|
|||||||
BlockProfileRate: 1,
|
BlockProfileRate: 1,
|
||||||
MutexProfileRate: 1,
|
MutexProfileRate: 1,
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("custom"),
|
|
||||||
Address: ":6061",
|
Address: ":6061",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -87,7 +83,6 @@ func Test_Settings_Copy(t *testing.T) {
|
|||||||
BlockProfileRate: 1,
|
BlockProfileRate: 1,
|
||||||
MutexProfileRate: 1,
|
MutexProfileRate: 1,
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("custom"),
|
|
||||||
Address: ":6061",
|
Address: ":6061",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -325,7 +320,6 @@ func Test_Settings_String(t *testing.T) {
|
|||||||
BlockProfileRate: 2,
|
BlockProfileRate: 2,
|
||||||
MutexProfileRate: 1,
|
MutexProfileRate: 1,
|
||||||
HTTPServer: httpserver.Settings{
|
HTTPServer: httpserver.Settings{
|
||||||
Name: stringPtr("name"),
|
|
||||||
Address: ":8000",
|
Address: ":8000",
|
||||||
ShutdownTimeout: durationPtr(time.Second),
|
ShutdownTimeout: durationPtr(time.Second),
|
||||||
},
|
},
|
||||||
@@ -333,7 +327,7 @@ func Test_Settings_String(t *testing.T) {
|
|||||||
s: `Pprof settings:
|
s: `Pprof settings:
|
||||||
├── Block profile rate: 2
|
├── Block profile rate: 2
|
||||||
├── Mutex profile rate: 1
|
├── Mutex profile rate: 1
|
||||||
└── Name HTTP server settings:
|
└── HTTP server settings:
|
||||||
├── Listening address: :8000
|
├── Listening address: :8000
|
||||||
└── Shutdown timeout: 1s`,
|
└── Shutdown timeout: 1s`,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user