diff --git a/config/config.go b/config/config.go index 9b1a8ca11ca52..221a90c53bd91 100644 --- a/config/config.go +++ b/config/config.go @@ -565,6 +565,7 @@ var defaultConf = Config{ Host: DefHost, AdvertiseAddress: "", Port: DefPort, + Socket: "/tmp/tidb.sock", Cors: "", Store: "unistore", Path: "/tmp/tidb", diff --git a/config/config.toml.example b/config/config.toml.example index 7b8251d9a0fc6..7f07013776ec1 100644 --- a/config/config.toml.example +++ b/config/config.toml.example @@ -16,7 +16,7 @@ store = "unistore" path = "/tmp/tidb" # The socket file to use for connection. -socket = "" +socket = "/tmp/tidb.sock" # Run ddl worker on this tidb-server. run-ddl = true diff --git a/server/conn_test.go b/server/conn_test.go index 49fe737043f08..02d4337c890f0 100644 --- a/server/conn_test.go +++ b/server/conn_test.go @@ -178,6 +178,7 @@ func TestInitialHandshake(t *testing.T) { var outBuffer bytes.Buffer cfg := newTestConfig() + cfg.Socket = "" cfg.Port = 0 cfg.Status.StatusPort = 0 drv := NewTiDBDriver(store) @@ -486,6 +487,7 @@ func testDispatch(t *testing.T, inputs []dispatchInput, capability uint32) { var outBuffer bytes.Buffer tidbdrv := NewTiDBDriver(store) cfg := newTestConfig() + cfg.Socket = "" cfg.Port, cfg.Status.StatusPort = 0, 0 cfg.Status.ReportStatus = false server, err := NewServer(cfg, tidbdrv) diff --git a/server/tidb_test.go b/server/tidb_test.go index d788f276ec10a..638fe17d20606 100644 --- a/server/tidb_test.go +++ b/server/tidb_test.go @@ -129,6 +129,7 @@ func (ts *tidbTestSuiteBase) SetUpSuite(c *C) { c.Assert(err, IsNil) ts.tidbdrv = NewTiDBDriver(ts.store) cfg := newTestConfig() + cfg.Socket = "" cfg.Port = ts.port cfg.Status.ReportStatus = true cfg.Status.StatusPort = ts.statusPort @@ -274,6 +275,7 @@ func (ts *tidbTestSuite) TestStatusPort(c *C) { defer dom.Close() ts.tidbdrv = NewTiDBDriver(store) cfg := newTestConfig() + cfg.Socket = "" cfg.Port = 0 cfg.Status.ReportStatus = true cfg.Status.StatusPort = ts.statusPort @@ -300,6 +302,7 @@ func (ts *tidbTestSuite) TestStatusAPIWithTLS(c *C) { cli := newTestServerClient() cli.statusScheme = "https" cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.StatusPort = cli.statusPort cfg.Security.ClusterSSLCA = "/tmp/ca-cert-2.pem" @@ -351,6 +354,7 @@ func (ts *tidbTestSuite) TestStatusAPIWithTLSCNCheck(c *C) { cli := newTestServerClient() cli.statusScheme = "https" cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.StatusPort = cli.statusPort cfg.Security.ClusterSSLCA = caPath @@ -866,6 +870,7 @@ func registerTLSConfig(configName string, caCertPath string, clientCertPath stri func (ts *tidbTestSuite) TestSystemTimeZone(c *C) { tk := testkit.NewTestKit(c, ts.store) cfg := newTestConfig() + cfg.Socket = "" cfg.Port, cfg.Status.StatusPort = 0, 0 cfg.Status.ReportStatus = false server, err := NewServer(cfg, ts.tidbdrv) @@ -883,6 +888,7 @@ func (ts *tidbTestSerialSuite) TestTLSAuto(c *C) { } cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security.AutoTLS = true @@ -935,6 +941,7 @@ func (ts *tidbTestSerialSuite) TestTLSBasic(c *C) { } cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security = config.Security{ @@ -1001,6 +1008,7 @@ func (ts *tidbTestSerialSuite) TestTLSVerify(c *C) { // Start the server with TLS & CA, if the client presents its certificate, the certificate will be verified. cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security = config.Security{ @@ -1066,6 +1074,7 @@ func (ts *tidbTestSerialSuite) TestReloadTLS(c *C) { // try old cert used in startup configuration. cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security = config.Security{ @@ -1166,6 +1175,7 @@ func (ts *tidbTestSerialSuite) TestErrorNoRollback(c *C) { cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false @@ -1500,6 +1510,7 @@ func (ts *tidbTestSuite) TestGracefulShutdown(c *C) { ts.tidbdrv = NewTiDBDriver(ts.store) cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.GracefulWaitBeforeShutdown = 2 // wait before shutdown cfg.Port = 0 cfg.Status.StatusPort = 0