From d7c2333e632863873c41c9c627679658b2177b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 6 Dec 2021 11:13:55 +0100 Subject: [PATCH] server: Fix unstable tests with FakeAuthSwitch (#30287) --- server/conn_test.go | 8 -------- server/tidb_serial_test.go | 5 ----- server/tidb_test.go | 6 ------ server/util_test.go | 1 + 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/server/conn_test.go b/server/conn_test.go index 9e2f40d366151..cd35257d72454 100644 --- a/server/conn_test.go +++ b/server/conn_test.go @@ -180,7 +180,6 @@ func TestInitialHandshake(t *testing.T) { var outBuffer bytes.Buffer cfg := newTestConfig() - cfg.Socket = "" cfg.Port = 0 cfg.Status.StatusPort = 0 drv := NewTiDBDriver(store) @@ -489,7 +488,6 @@ 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) @@ -911,8 +909,6 @@ func TestShowErrors(t *testing.T) { } func TestHandleAuthPlugin(t *testing.T) { - t.Parallel() - store, clean := testkit.CreateMockStore(t) defer clean() @@ -1132,14 +1128,10 @@ func TestHandleAuthPlugin(t *testing.T) { } func TestAuthPlugin2(t *testing.T) { - - t.Parallel() - store, clean := testkit.CreateMockStore(t) defer clean() cfg := newTestConfig() - cfg.Socket = "" cfg.Port = 0 cfg.Status.StatusPort = 0 diff --git a/server/tidb_serial_test.go b/server/tidb_serial_test.go index b5f2483584052..68b5d634a5a4a 100644 --- a/server/tidb_serial_test.go +++ b/server/tidb_serial_test.go @@ -106,7 +106,6 @@ func TestTLSAuto(t *testing.T) { } cli := newTestServerClient() cfg := newTestConfig() - cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security.AutoTLS = true @@ -162,7 +161,6 @@ func TestTLSBasic(t *testing.T) { } cli := newTestServerClient() cfg := newTestConfig() - cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false cfg.Security = config.Security{ @@ -234,7 +232,6 @@ func TestTLSVerify(t *testing.T) { // 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{ @@ -302,7 +299,6 @@ func TestErrorNoRollback(t *testing.T) { cli := newTestServerClient() cfg := newTestConfig() - cfg.Socket = "" cfg.Port = cli.port cfg.Status.ReportStatus = false @@ -422,7 +418,6 @@ func TestReloadTLS(t *testing.T) { // 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{ diff --git a/server/tidb_test.go b/server/tidb_test.go index c76ad1957a766..eab37278c5b64 100644 --- a/server/tidb_test.go +++ b/server/tidb_test.go @@ -76,7 +76,6 @@ func createTidbTestSuite(t *testing.T) (*tidbTestSuite, func()) { require.NoError(t, err) ts.tidbdrv = NewTiDBDriver(ts.store) cfg := newTestConfig() - cfg.Socket = "" cfg.Port = ts.port cfg.Status.ReportStatus = true cfg.Status.StatusPort = ts.statusPort @@ -242,7 +241,6 @@ func TestStatusPort(t *testing.T) { defer cleanup() cfg := newTestConfig() - cfg.Socket = "" cfg.Port = 0 cfg.Status.ReportStatus = true cfg.Status.StatusPort = ts.statusPort @@ -273,7 +271,6 @@ func TestStatusAPIWithTLS(t *testing.T) { 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" @@ -329,7 +326,6 @@ func TestStatusAPIWithTLSCNCheck(t *testing.T) { cli := newTestServerClient() cli.statusScheme = "https" cfg := newTestConfig() - cfg.Socket = "" cfg.Port = cli.port cfg.Status.StatusPort = cli.statusPort cfg.Security.ClusterSSLCA = caPath @@ -887,7 +883,6 @@ func TestSystemTimeZone(t *testing.T) { tk := testkit.NewTestKit(t, ts.store) cfg := newTestConfig() - cfg.Socket = "" cfg.Port, cfg.Status.StatusPort = 0, 0 cfg.Status.ReportStatus = false server, err := NewServer(cfg, ts.tidbdrv) @@ -1216,7 +1211,6 @@ func TestGracefulShutdown(t *testing.T) { cli := newTestServerClient() cfg := newTestConfig() - cfg.Socket = "" cfg.GracefulWaitBeforeShutdown = 2 // wait before shutdown cfg.Port = 0 cfg.Status.StatusPort = 0 diff --git a/server/util_test.go b/server/util_test.go index 35680210b75e4..c60f00bdf4e51 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -604,5 +604,6 @@ func newTestConfig() *config.Config { cfg.Host = "127.0.0.1" cfg.Status.StatusHost = "127.0.0.1" cfg.Security.AutoTLS = false + cfg.Socket = "" return cfg }