go fmt
This commit is contained in:
@@ -81,9 +81,9 @@ func buildTree() *Node {
|
||||
setDisabled := &Node{Word: "disabled", Help: "disable backend (not implemented)", Run: runNotImplemented}
|
||||
setEnabled := &Node{Word: "enabled", Help: "enable backend (not implemented)", Run: runNotImplemented}
|
||||
setBackendName := &Node{
|
||||
Word: "<name>",
|
||||
Help: "backend name",
|
||||
Dynamic: dynBackends,
|
||||
Word: "<name>",
|
||||
Help: "backend name",
|
||||
Dynamic: dynBackends,
|
||||
Children: []*Node{setPause, setResume, setDisabled, setEnabled},
|
||||
}
|
||||
setBackend := &Node{
|
||||
|
||||
@@ -86,10 +86,10 @@ type rawConfig struct {
|
||||
}
|
||||
|
||||
type rawMaglev struct {
|
||||
HealthChecker rawHealthCheckerCfg `yaml:"healthchecker"`
|
||||
HealthChecker rawHealthCheckerCfg `yaml:"healthchecker"`
|
||||
HealthChecks map[string]rawHealthCheck `yaml:"healthchecks"`
|
||||
Backends map[string]rawBackend `yaml:"backends"`
|
||||
Frontends map[string]rawFrontend `yaml:"frontends"`
|
||||
Backends map[string]rawBackend `yaml:"backends"`
|
||||
Frontends map[string]rawFrontend `yaml:"frontends"`
|
||||
}
|
||||
|
||||
type rawHealthCheckerCfg struct {
|
||||
|
||||
@@ -98,7 +98,7 @@ func TestGetFrontend(t *testing.T) {
|
||||
client, cleanup := startTestServer(t, ctx, c)
|
||||
defer cleanup()
|
||||
|
||||
info, err := client.GetFrontend(ctx, &GetFrontendRequest{Name:"web"})
|
||||
info, err := client.GetFrontend(ctx, &GetFrontendRequest{Name: "web"})
|
||||
if err != nil {
|
||||
t.Fatalf("GetFrontend: %v", err)
|
||||
}
|
||||
@@ -121,7 +121,7 @@ func TestGetFrontendNotFound(t *testing.T) {
|
||||
client, cleanup := startTestServer(t, ctx, c)
|
||||
defer cleanup()
|
||||
|
||||
_, err := client.GetFrontend(ctx, &GetFrontendRequest{Name:"nope"})
|
||||
_, err := client.GetFrontend(ctx, &GetFrontendRequest{Name: "nope"})
|
||||
if err == nil {
|
||||
t.Error("expected error for unknown frontend")
|
||||
}
|
||||
@@ -152,7 +152,7 @@ func TestGetBackend(t *testing.T) {
|
||||
client, cleanup := startTestServer(t, ctx, c)
|
||||
defer cleanup()
|
||||
|
||||
info, err := client.GetBackend(ctx, &GetBackendRequest{Name:"be0"})
|
||||
info, err := client.GetBackend(ctx, &GetBackendRequest{Name: "be0"})
|
||||
if err != nil {
|
||||
t.Fatalf("GetBackend: %v", err)
|
||||
}
|
||||
@@ -178,7 +178,7 @@ func TestGetBackendNotFound(t *testing.T) {
|
||||
client, cleanup := startTestServer(t, ctx, c)
|
||||
defer cleanup()
|
||||
|
||||
_, err := client.GetBackend(ctx, &GetBackendRequest{Name:"nope"})
|
||||
_, err := client.GetBackend(ctx, &GetBackendRequest{Name: "nope"})
|
||||
if err == nil {
|
||||
t.Error("expected error for unknown backend")
|
||||
}
|
||||
@@ -192,7 +192,7 @@ func TestPauseResumeBackend(t *testing.T) {
|
||||
client, cleanup := startTestServer(t, ctx, c)
|
||||
defer cleanup()
|
||||
|
||||
info, err := client.PauseBackend(ctx, &PauseResumeRequest{Name:"be0"})
|
||||
info, err := client.PauseBackend(ctx, &PauseResumeRequest{Name: "be0"})
|
||||
if err != nil {
|
||||
t.Fatalf("PauseBackend: %v", err)
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func TestPauseResumeBackend(t *testing.T) {
|
||||
t.Errorf("after pause: got %q, want paused", info.State)
|
||||
}
|
||||
|
||||
info, err = client.ResumeBackend(ctx, &PauseResumeRequest{Name:"be0"})
|
||||
info, err = client.ResumeBackend(ctx, &PauseResumeRequest{Name: "be0"})
|
||||
if err != nil {
|
||||
t.Fatalf("ResumeBackend: %v", err)
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ func TestTransitionHistory(t *testing.T) {
|
||||
maxHistory := 3
|
||||
|
||||
// Drive several state changes. Each cycle: pass×2→Up, fail→Down (Unknown→Down on first fail).
|
||||
b.Record(fail(), maxHistory) // Unknown→Down
|
||||
b.Record(pass(), maxHistory) // counter++
|
||||
b.Record(pass(), maxHistory) // Down→Up
|
||||
b.Record(fail(), maxHistory) // Up: counter drops
|
||||
b.Record(fail(), maxHistory) // Up: counter drops
|
||||
b.Record(fail(), maxHistory) // Up→Down
|
||||
b.Record(pass(), maxHistory) // counter++
|
||||
b.Record(pass(), maxHistory) // Down→Up
|
||||
b.Record(fail(), maxHistory) // Unknown→Down
|
||||
b.Record(pass(), maxHistory) // counter++
|
||||
b.Record(pass(), maxHistory) // Down→Up
|
||||
b.Record(fail(), maxHistory) // Up: counter drops
|
||||
b.Record(fail(), maxHistory) // Up: counter drops
|
||||
b.Record(fail(), maxHistory) // Up→Down
|
||||
b.Record(pass(), maxHistory) // counter++
|
||||
b.Record(pass(), maxHistory) // Down→Up
|
||||
|
||||
if len(b.Transitions) != maxHistory {
|
||||
t.Errorf("transitions capped at %d, got %d", maxHistory, len(b.Transitions))
|
||||
|
||||
@@ -17,10 +17,10 @@ type ProbeFunc func(ctx context.Context, cfg ProbeConfig) health.ProbeResult
|
||||
|
||||
// ProbeConfig holds all parameters needed to execute a single probe.
|
||||
type ProbeConfig struct {
|
||||
Target net.IP // backend address to probe
|
||||
Port uint16 // destination port (used by TCP and HTTP probers)
|
||||
ProbeSrc net.IP // source address to bind; nil lets the OS choose
|
||||
HealthCheckNetns string // network namespace name; sockets are created inside it
|
||||
Target net.IP // backend address to probe
|
||||
Port uint16 // destination port (used by TCP and HTTP probers)
|
||||
ProbeSrc net.IP // source address to bind; nil lets the OS choose
|
||||
HealthCheckNetns string // network namespace name; sockets are created inside it
|
||||
Timeout time.Duration
|
||||
HTTP *config.HTTPParams // non-nil for type http/https
|
||||
TCP *config.TCPParams // non-nil for type tcp
|
||||
|
||||
Reference in New Issue
Block a user