Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
djshow832 committed Nov 15, 2023
1 parent d53bf9a commit 2eeb34b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func NewSQLServer(logger *zap.Logger, cfg config.ProxyServer, certMgr *cert.Cert
mu: serverState{
connID: 0,
clients: make(map[uint64]*client.ClientConnection),
status: statusNormal,
},
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ func TestWatchCfg(t *testing.T) {
cfg := &config.Config{
Proxy: config.ProxyServer{
ProxyServerOnline: config.ProxyServerOnline{
RequireBackendTLS: true,
MaxConnections: 100,
ConnBufferSize: 1024 * 1024,
ProxyProtocol: "v2",
GracefulWaitBeforeShutdown: 100,
RequireBackendTLS: true,
MaxConnections: 100,
ConnBufferSize: 1024 * 1024,
ProxyProtocol: "v2",
GracefulCloseConnTimeout: 100,
},
},
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/server/api/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func TestConfig(t *testing.T) {
addr = '0.0.0.0:6000'
pd-addrs = '127.0.0.1:2379'
require-backend-tls = true
graceful-close-conn-timeout = 15
[proxy.frontend-keepalive]
enabled = true
Expand Down Expand Up @@ -75,7 +76,7 @@ max-backups = 3
doHTTP(t, http.MethodGet, "/api/admin/config?format=json", nil, func(t *testing.T, r *http.Response) {
all, err := io.ReadAll(r.Body)
require.NoError(t, err)
require.Equal(t, `{"proxy":{"addr":"0.0.0.0:6000","pd-addrs":"127.0.0.1:2379","require-backend-tls":true,"frontend-keepalive":{"enabled":true},"backend-healthy-keepalive":{"enabled":true,"idle":60000000000,"cnt":5,"intvl":3000000000,"timeout":15000000000},"backend-unhealthy-keepalive":{"enabled":true,"idle":10000000000,"cnt":5,"intvl":1000000000,"timeout":5000000000}},"api":{"addr":"0.0.0.0:3080"},"advance":{"ignore-wrong-namespace":true},"security":{"server-tls":{"min-tls-version":"1.1"},"peer-tls":{"min-tls-version":"1.1"},"cluster-tls":{"min-tls-version":"1.1"},"sql-tls":{"min-tls-version":"1.1"}},"metrics":{"metrics-addr":"","metrics-interval":0},"log":{"encoder":"tidb","level":"info","log-file":{"max-size":300,"max-days":3,"max-backups":3}}}`,
require.Equal(t, `{"proxy":{"addr":"0.0.0.0:6000","pd-addrs":"127.0.0.1:2379","require-backend-tls":true,"frontend-keepalive":{"enabled":true},"backend-healthy-keepalive":{"enabled":true,"idle":60000000000,"cnt":5,"intvl":3000000000,"timeout":15000000000},"backend-unhealthy-keepalive":{"enabled":true,"idle":10000000000,"cnt":5,"intvl":1000000000,"timeout":5000000000},"graceful-close-conn-timeout":15},"api":{"addr":"0.0.0.0:3080"},"advance":{"ignore-wrong-namespace":true},"security":{"server-tls":{"min-tls-version":"1.1"},"peer-tls":{"min-tls-version":"1.1"},"cluster-tls":{"min-tls-version":"1.1"},"sql-tls":{"min-tls-version":"1.1"}},"metrics":{"metrics-addr":"","metrics-interval":0},"log":{"encoder":"tidb","level":"info","log-file":{"max-size":300,"max-days":3,"max-backups":3}}}`,
string(regexp.MustCompile(`"workdir":"[^"]+",`).ReplaceAll(all, nil)))
require.Equal(t, http.StatusOK, r.StatusCode)
})
Expand Down

0 comments on commit 2eeb34b

Please sign in to comment.