Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions components/playground/instance/tici.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,19 @@ func NewTiCIWorkerInstance(shOpt SharedOptions, baseDir, host string, id int, pd
func NewTiCIInstanceWithRole(shOpt SharedOptions, baseDir, host string, id int, pds []*PDInstance,
ticiDir, configDir string, role TiCIRole) *TiCIInstance {
var componentSuffix string
var defaultPort int
var defaultPort, defaultStatusPort int

switch role {
case TiCIRoleMeta:
// MetaServer default port
componentSuffix = "meta"
defaultPort = 8500 // MetaServer default port
defaultPort = 8500
defaultStatusPort = 8501
case TiCIRoleWorker:
// WorkerNode default port
componentSuffix = "worker"
defaultPort = 8501 // WorkerNode default port
defaultPort = 8510
defaultStatusPort = 8511
default:
panic("invalid TiCI role")
}
Expand All @@ -87,7 +91,7 @@ func NewTiCIInstanceWithRole(shOpt SharedOptions, baseDir, host string, id int,
Dir: dir,
Host: host,
Port: utils.MustGetFreePort(host, defaultPort, shOpt.PortOffset),
StatusPort: utils.MustGetFreePort(host, defaultPort+1, shOpt.PortOffset),
StatusPort: utils.MustGetFreePort(host, defaultStatusPort, shOpt.PortOffset),
ConfigPath: configDir,
},
pds: pds,
Expand Down Expand Up @@ -123,9 +127,9 @@ func (t *TiCIInstance) startMetaServer(ctx context.Context) error {
args := []string{}

// Use default or provided config path
metaConfigPath := filepath.Join(t.ticiDir, "ci", "test-meta-config.toml")
metaConfigPath := filepath.Join(t.ticiDir, "ci", "test-meta.toml")
if t.configDir != "" {
metaConfigPath = filepath.Join(t.configDir, "test-meta-config.toml")
metaConfigPath = filepath.Join(t.configDir, "test-meta.toml")
}
args = append(args, fmt.Sprintf("--config=%s", metaConfigPath))

Expand All @@ -144,9 +148,9 @@ func (t *TiCIInstance) startWorkerNode(ctx context.Context) error {
args := []string{}

// Use default or provided config path
workerConfigPath := filepath.Join(t.ticiDir, "ci", "test-writer.toml")
workerConfigPath := filepath.Join(t.ticiDir, "ci", "test-worker.toml")
if t.configDir != "" {
workerConfigPath = filepath.Join(t.configDir, "test-writer.toml")
workerConfigPath = filepath.Join(t.configDir, "test-worker.toml")
}
args = append(args, fmt.Sprintf("--config=%s", workerConfigPath))

Expand Down