Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit50ad4a8

Browse files
authored
fix: use backend for/healthz page (#4938)
1 parentbda7636 commit50ad4a8

File tree

7 files changed

+18
-36
lines changed

7 files changed

+18
-36
lines changed

‎coderd/coderd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ func New(options *Options) *API {
233233
httpmw.CSRF(options.SecureAuthCookie),
234234
)
235235

236+
r.Get("/healthz",func(w http.ResponseWriter,r*http.Request) {_,_=w.Write([]byte("OK")) })
237+
236238
apps:=func(r chi.Router) {
237239
r.Use(
238240
tracing.Middleware(api.TracerProvider),

‎coderd/coderd_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package coderd_test
22

33
import (
44
"context"
5+
"io"
56
"net/http"
67
"net/netip"
78
"strconv"
@@ -114,3 +115,17 @@ func TestDERPLatencyCheck(t *testing.T) {
114115
deferres.Body.Close()
115116
require.Equal(t,http.StatusOK,res.StatusCode)
116117
}
118+
funcTestHealthz(t*testing.T) {
119+
t.Parallel()
120+
client:=coderdtest.New(t,nil)
121+
122+
res,err:=client.Request(context.Background(),http.MethodGet,"/healthz",nil)
123+
require.NoError(t,err)
124+
deferres.Body.Close()
125+
126+
require.Equal(t,http.StatusOK,res.StatusCode)
127+
body,err:=io.ReadAll(res.Body)
128+
require.NoError(t,err)
129+
130+
assert.Equal(t,"OK",string(body))
131+
}

‎coderd/coderdtest/authorize.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
3737

3838
assertRoute:=map[string]RouteCheck{
3939
// These endpoints do not require auth
40+
"GET:/healthz": {NoAuthorize:true},
4041
"GET:/api/v2": {NoAuthorize:true},
4142
"GET:/api/v2/buildinfo": {NoAuthorize:true},
4243
"GET:/api/v2/users/first": {NoAuthorize:true},

‎site/e2e/pom/HealthzPage.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎site/e2e/tests/healthz.spec.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎site/src/AppRouter.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const NotFoundPage = lazy(() => import("./pages/404Page/404Page"))
3030
constCliAuthenticationPage=lazy(
3131
()=>import("./pages/CliAuthPage/CliAuthPage"),
3232
)
33-
constHealthzPage=lazy(()=>import("./pages/HealthzPage/HealthzPage"))
3433
constAccountPage=lazy(
3534
()=>import("./pages/UserSettingsPage/AccountPage/AccountPage"),
3635
)
@@ -107,7 +106,6 @@ export const AppRouter: FC = () => {
107106

108107
<Routepath="login"element={<LoginPage/>}/>
109108
<Routepath="setup"element={<SetupPage/>}/>
110-
<Routepath="healthz"element={<HealthzPage/>}/>
111109
<Route
112110
path="cli-auth"
113111
element={

‎site/src/pages/HealthzPage/HealthzPage.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp