Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: Fix unstable tests with FakeAuthSwitch #30287

Merged
merged 11 commits into from
Dec 6, 2021
8 changes: 0 additions & 8 deletions server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -911,8 +909,6 @@ func TestShowErrors(t *testing.T) {
}

func TestHandleAuthPlugin(t *testing.T) {
t.Parallel()

store, clean := testkit.CreateMockStore(t)
defer clean()

Expand Down Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions server/tidb_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -302,7 +299,6 @@ func TestErrorNoRollback(t *testing.T) {

cli := newTestServerClient()
cfg := newTestConfig()
cfg.Socket = ""
cfg.Port = cli.port
cfg.Status.ReportStatus = false

Expand Down Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}