mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-29 19:39:52 -05:00
Test the --back-log value gets written to config.yaml
This commit is contained in:
@@ -172,7 +172,7 @@ func NewCommandLineConfig(creds *cli.UserPassword, apr *argparser.ArgParseResult
|
||||
}
|
||||
|
||||
if maxWaitConnections, ok := apr.GetInt(maxWaitConnectionsFlag); ok {
|
||||
config.maxWaitConnections = uint32(maxWaitConnections)
|
||||
config.withMaxWaitConnections(uint32(maxWaitConnections))
|
||||
}
|
||||
|
||||
config.autoCommit = !apr.Contains(noAutoCommitFlag)
|
||||
@@ -437,6 +437,12 @@ func (cfg *commandLineServerConfig) withMaxConnections(maxConnections uint64) *c
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (cfg *commandLineServerConfig) withMaxWaitConnections(maxWaitConnections uint32) *commandLineServerConfig {
|
||||
cfg.maxWaitConnections = maxWaitConnections
|
||||
cfg.valuesSet[servercfg.MaxWaitConnectionsKey] = struct{}{}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// withDataDir updates the path to a directory to use as the data dir.
|
||||
func (cfg *commandLineServerConfig) withDataDir(dataDir string) *commandLineServerConfig {
|
||||
cfg.dataDir = dataDir
|
||||
|
||||
@@ -311,6 +311,7 @@ const (
|
||||
DataDirKey = "data_dir"
|
||||
CfgDirKey = "cfg_dir"
|
||||
MaxConnectionsKey = "max_connections"
|
||||
MaxWaitConnectionsKey = "back_log"
|
||||
TLSKeyKey = "tls_key"
|
||||
TLSCertKey = "tls_cert"
|
||||
RequireSecureTransportKey = "require_secure_transport"
|
||||
|
||||
@@ -198,6 +198,7 @@ func ServerConfigAsYAMLConfig(cfg ServerConfig) *YAMLConfig {
|
||||
HostStr: ptr(cfg.Host()),
|
||||
PortNumber: ptr(cfg.Port()),
|
||||
MaxConnections: ptr(cfg.MaxConnections()),
|
||||
BackLog: ptr(cfg.MaxWaitConnections()),
|
||||
ReadTimeoutMillis: ptr(cfg.ReadTimeout()),
|
||||
WriteTimeoutMillis: ptr(cfg.WriteTimeout()),
|
||||
TLSKey: nillableStrPtr(cfg.TLSKey()),
|
||||
@@ -268,6 +269,7 @@ func ServerConfigSetValuesAsYAMLConfig(cfg ServerConfig) *YAMLConfig {
|
||||
HostStr: zeroIf(ptr(cfg.Host()), !cfg.ValueSet(HostKey)),
|
||||
PortNumber: zeroIf(ptr(cfg.Port()), !cfg.ValueSet(PortKey)),
|
||||
MaxConnections: zeroIf(ptr(cfg.MaxConnections()), !cfg.ValueSet(MaxConnectionsKey)),
|
||||
BackLog: zeroIf(ptr(cfg.MaxWaitConnections()), !cfg.ValueSet(MaxWaitConnectionsKey)),
|
||||
ReadTimeoutMillis: zeroIf(ptr(cfg.ReadTimeout()), !cfg.ValueSet(ReadTimeoutKey)),
|
||||
WriteTimeoutMillis: zeroIf(ptr(cfg.WriteTimeout()), !cfg.ValueSet(WriteTimeoutKey)),
|
||||
TLSKey: zeroIf(ptr(cfg.TLSKey()), !cfg.ValueSet(TLSKeyKey)),
|
||||
@@ -958,6 +960,8 @@ func (cfg YAMLConfig) ValueSet(value string) bool {
|
||||
return cfg.ListenerConfig.WriteTimeoutMillis != nil
|
||||
case MaxConnectionsKey:
|
||||
return cfg.ListenerConfig.MaxConnections != nil
|
||||
case MaxWaitConnectionsKey:
|
||||
return cfg.ListenerConfig.BackLog != nil
|
||||
case EventSchedulerKey:
|
||||
return cfg.BehaviorConfig.EventSchedulerStatus != nil
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ EOF
|
||||
--max-connections 77 \
|
||||
--timeout 7777777 \
|
||||
--allow-cleartext-passwords true \
|
||||
--back-log 767 \
|
||||
--host 0.0.0.0
|
||||
|
||||
run cat "$CONFIG_FILE_NAME"
|
||||
@@ -108,6 +109,7 @@ EOF
|
||||
[[ "$output" =~ "read_timeout_millis: 7777777" ]] || false
|
||||
[[ "$output" =~ "write_timeout_millis: 7777777" ]] || false
|
||||
[[ "$output" =~ "allow_cleartext_passwords: true" ]] || false
|
||||
[[ "$output" =~ "back_log: 767" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-server-config-file-generation: generated config file uses default values as placeholders for unset fields" {
|
||||
|
||||
Reference in New Issue
Block a user