remove authentication for healthz api (#2672)

This commit is contained in:
fatedier
2021-11-23 14:14:27 +08:00
committed by GitHub
parent cbdd73b94f
commit 05b1ace21f
6 changed files with 82 additions and 26 deletions

View File

@@ -144,4 +144,36 @@ var _ = Describe("[Feature: Server Manager]", func() {
r.HTTP().HTTPHost("example.com")
}).PortName(consts.PortServerName).Ensure()
})
It("healthz", func() {
serverConf := consts.DefaultServerConfig
dashboardPort := f.AllocPort()
// Use same port as PortServer
serverConf += fmt.Sprintf(`
vhost_http_port = {{ .%s }}
dashboard_addr = 0.0.0.0
dashboard_port = %d
dashboard_user = admin
dashboard_pwd = admin
`, consts.PortServerName, dashboardPort)
clientConf := consts.DefaultClientConfig + fmt.Sprintf(`
[http]
type = http
local_port = {{ .%s }}
custom_domains = example.com
`, framework.HTTPSimpleServerPort)
f.RunProcesses([]string{serverConf}, []string{clientConf})
framework.NewRequestExpect(f).RequestModify(func(r *request.Request) {
r.HTTP().HTTPPath("/healthz")
}).Port(dashboardPort).ExpectResp([]byte("")).Ensure()
framework.NewRequestExpect(f).RequestModify(func(r *request.Request) {
r.HTTP().HTTPPath("/")
}).Port(dashboardPort).
Ensure(framework.ExpectResponseCode(401))
})
})