Skip to content

Commit

Permalink
Fixed failing tests related to Proxies and LoadBalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
sinadarbouy committed Jul 17, 2024
1 parent e44b0a8 commit f90c704
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ func (c *Config) LoadDefaults(ctx context.Context) *gerr.GatewayDError {
CertFile: "",
KeyFile: "",
HandshakeTimeout: DefaultHandshakeTimeout,
Proxies: []string{Default},
LoadBalancer: LoadBalancer{Strategy: DefaultLoadBalancerStrategy},
}

c.globalDefaults = GlobalConfig{
Expand Down Expand Up @@ -413,7 +415,7 @@ func (c *Config) ValidateGlobalConfig(ctx context.Context) *gerr.GatewayDError {
}

var errors []*gerr.GatewayDError
configObjects := []string{"loggers", "metrics", "clients", "pools", "proxies", "servers"}
configObjects := []string{"loggers", "metrics", "servers"}
sort.Strings(configObjects)
var seenConfigObjects []string

Expand Down
9 changes: 5 additions & 4 deletions config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ const (
DefaultHealthCheckPeriod = 60 * time.Second // This must match PostgreSQL authentication timeout.

// Server constants.
DefaultListenNetwork = "tcp"
DefaultListenAddress = "0.0.0.0:15432"
DefaultTickInterval = 5 * time.Second
DefaultHandshakeTimeout = 5 * time.Second
DefaultListenNetwork = "tcp"
DefaultListenAddress = "0.0.0.0:15432"
DefaultTickInterval = 5 * time.Second
DefaultHandshakeTimeout = 5 * time.Second
DefaultLoadBalancerStrategy = "ROUND_ROBIN"

// Utility constants.
DefaultSeed = 1000
Expand Down
11 changes: 6 additions & 5 deletions network/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ func TestRunServer(t *testing.T) {
Options: Option{
EnableTicker: true,
},
Proxies: []IProxy{proxy},
Logger: logger,
PluginRegistry: pluginRegistry,
PluginTimeout: config.DefaultPluginTimeout,
HandshakeTimeout: config.DefaultHandshakeTimeout,
Proxies: []IProxy{proxy},
Logger: logger,
PluginRegistry: pluginRegistry,
PluginTimeout: config.DefaultPluginTimeout,
HandshakeTimeout: config.DefaultHandshakeTimeout,
LoadbalancerStrategyName: RoundRobinStrategy,
},
)
assert.NotNil(t, server)
Expand Down

0 comments on commit f90c704

Please sign in to comment.