From fa1cbfa27918d2abdf8673c6ef8e89600a8a9e13 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Wed, 29 Sep 2021 13:20:09 -0600 Subject: [PATCH] Change default for unix socket --- config/config.go | 1 + config/config.toml.example | 2 +- server/conn_test.go | 2 ++ server/tidb_test.go | 11 +++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 6740055034f07..6b8ddcef16080 100644 --- a/config/config.go +++ b/config/config.go @@ -564,6 +564,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 9901d0367528f..42c2b3c68f45d 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 a9e34bb24fe99..35128b9d17f9e 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 @@ -865,6 +869,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) @@ -882,6 +887,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 @@ -934,6 +940,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{ @@ -1000,6 +1007,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{ @@ -1065,6 +1073,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{ @@ -1165,6 +1174,7 @@ func (ts *tidbTestSerialSuite) TestErrorNoRollback(c *C) { cli := newTestServerClient() cfg := newTestConfig() + cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false @@ -1499,6 +1509,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