mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-13 11:19:49 -06:00
Exporting WithPort from DoltServerConfig and customizing port for dolt_server_test.
This commit is contained in:
@@ -154,17 +154,17 @@ func TestServerGoodParams(t *testing.T) {
|
||||
|
||||
tests := []ServerConfig{
|
||||
DefaultServerConfig(),
|
||||
DefaultServerConfig().withHost("127.0.0.1").withPort(15400),
|
||||
DefaultServerConfig().withHost("localhost").withPort(15401),
|
||||
//DefaultServerConfig().withHost("::1").withPort(15402), // Fails on Jenkins, assuming no IPv6 support
|
||||
DefaultServerConfig().withUser("testusername").withPort(15403),
|
||||
DefaultServerConfig().withPassword("hunter2").withPort(15404),
|
||||
DefaultServerConfig().withTimeout(0).withPort(15405),
|
||||
DefaultServerConfig().withTimeout(5).withPort(15406),
|
||||
DefaultServerConfig().withLogLevel(LogLevel_Debug).withPort(15407),
|
||||
DefaultServerConfig().withLogLevel(LogLevel_Info).withPort(15408),
|
||||
DefaultServerConfig().withReadOnly(true).withPort(15409),
|
||||
DefaultServerConfig().withUser("testusernamE").withPassword("hunter2").withTimeout(4).withPort(15410),
|
||||
DefaultServerConfig().withHost("127.0.0.1").WithPort(15400),
|
||||
DefaultServerConfig().withHost("localhost").WithPort(15401),
|
||||
//DefaultServerConfig().withHost("::1").WithPort(15402), // Fails on Jenkins, assuming no IPv6 support
|
||||
DefaultServerConfig().withUser("testusername").WithPort(15403),
|
||||
DefaultServerConfig().withPassword("hunter2").WithPort(15404),
|
||||
DefaultServerConfig().withTimeout(0).WithPort(15405),
|
||||
DefaultServerConfig().withTimeout(5).WithPort(15406),
|
||||
DefaultServerConfig().withLogLevel(LogLevel_Debug).WithPort(15407),
|
||||
DefaultServerConfig().withLogLevel(LogLevel_Info).WithPort(15408),
|
||||
DefaultServerConfig().withReadOnly(true).WithPort(15409),
|
||||
DefaultServerConfig().withUser("testusernamE").withPassword("hunter2").withTimeout(4).WithPort(15410),
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
@@ -188,7 +188,7 @@ func TestServerGoodParams(t *testing.T) {
|
||||
|
||||
func TestServerSelect(t *testing.T) {
|
||||
env := dtestutils.CreateEnvWithSeedData(t)
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).withPort(15300)
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).WithPort(15300)
|
||||
|
||||
sc := NewServerController()
|
||||
defer sc.StopServer()
|
||||
@@ -263,7 +263,7 @@ func TestServerFailsIfPortInUse(t *testing.T) {
|
||||
|
||||
func TestServerSetDefaultBranch(t *testing.T) {
|
||||
dEnv := dtestutils.CreateEnvWithSeedData(t)
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).withPort(15302)
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).WithPort(15302)
|
||||
|
||||
sc := NewServerController()
|
||||
defer sc.StopServer()
|
||||
@@ -413,7 +413,7 @@ func TestReadReplica(t *testing.T) {
|
||||
|
||||
// start server as read replica
|
||||
sc := NewServerController()
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).withPort(15303)
|
||||
serverConfig := DefaultServerConfig().withLogLevel(LogLevel_Fatal).WithPort(15303)
|
||||
|
||||
func() {
|
||||
os.Chdir(multiSetup.DbPaths[readReplicaDbName])
|
||||
|
||||
@@ -267,8 +267,8 @@ func (cfg *commandLineServerConfig) withHost(host string) *commandLineServerConf
|
||||
return cfg
|
||||
}
|
||||
|
||||
// withPort updates the port and returns the called `*commandLineServerConfig`, which is useful for chaining calls.
|
||||
func (cfg *commandLineServerConfig) withPort(port int) *commandLineServerConfig {
|
||||
// WithPort updates the port and returns the called `*commandLineServerConfig`, which is useful for chaining calls.
|
||||
func (cfg *commandLineServerConfig) WithPort(port int) *commandLineServerConfig {
|
||||
cfg.port = port
|
||||
return cfg
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ func getCommandLineServerConfig(dEnv *env.DoltEnv, apr *argparser.ArgParseResult
|
||||
serverConfig.withHost(host)
|
||||
}
|
||||
if port, ok := apr.GetInt(portFlag); ok {
|
||||
serverConfig.withPort(port)
|
||||
serverConfig.WithPort(port)
|
||||
}
|
||||
if user, ok := apr.GetValue(userFlag); ok {
|
||||
serverConfig.withUser(user)
|
||||
|
||||
@@ -17,6 +17,7 @@ package enginetest
|
||||
import (
|
||||
"context"
|
||||
gosql "database/sql"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -220,8 +221,8 @@ func assertResultsEqual(t *testing.T, expected []sql.Row, rows *gosql.Rows) {
|
||||
|
||||
func startServer(t *testing.T) (*sqlserver.ServerController, sqlserver.ServerConfig) {
|
||||
dEnv := dtestutils.CreateEnvWithSeedData(t)
|
||||
// TODO: customize port?
|
||||
serverConfig := sqlserver.DefaultServerConfig()
|
||||
port := 15403 + rand.Intn(25)
|
||||
serverConfig := sqlserver.DefaultServerConfig().WithPort(port)
|
||||
|
||||
sc := sqlserver.NewServerController()
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user