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

Commit9f4f953

Browse files
authored
fix(coderd/healthcheck): ignore deleted wsproxies in wsproxy healthcheck (#11515)
1 parente5b9d63 commit9f4f953

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

‎coderd/healthcheck/workspaceproxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
7676
return
7777
}
7878

79-
r.WorkspaceProxies=proxies
79+
for_,proxy:=rangeproxies.Regions {
80+
if!proxy.Deleted {
81+
r.WorkspaceProxies.Regions=append(r.WorkspaceProxies.Regions,proxy)
82+
}
83+
}
8084
ifr.WorkspaceProxies.Regions==nil {
8185
r.WorkspaceProxies.Regions=make([]codersdk.WorkspaceProxy,0)
8286
}

‎coderd/healthcheck/workspaceproxy_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ func TestWorkspaceProxies(t *testing.T) {
164164
expectedSeverity:health.SeverityWarning,
165165
expectedWarningCode:health.CodeProxyUpdate,
166166
},
167+
{
168+
name:"Enabled/OneUnhealthyAndDeleted",
169+
fetchWorkspaceProxies:fakeFetchWorkspaceProxies(fakeWorkspaceProxy("alpha",false,currentVersion,func(wp*codersdk.WorkspaceProxy) {
170+
wp.Deleted=true
171+
})),
172+
updateProxyHealth:fakeUpdateProxyHealth(nil),
173+
expectedHealthy:true,
174+
expectedSeverity:health.SeverityOK,
175+
},
167176
} {
168177
tt:=tt
169178
t.Run(tt.name,func(t*testing.T) {
@@ -236,7 +245,7 @@ func (u *fakeWorkspaceProxyFetchUpdater) Update(ctx context.Context) error {
236245
}
237246

238247
//nolint:revive // yes, this is a control flag, and that is OK in a unit test.
239-
funcfakeWorkspaceProxy(namestring,healthybool,versionstring) codersdk.WorkspaceProxy {
248+
funcfakeWorkspaceProxy(namestring,healthybool,versionstring,mutators...func(*codersdk.WorkspaceProxy)) codersdk.WorkspaceProxy {
240249
varstatus codersdk.WorkspaceProxyStatus
241250
if!healthy {
242251
status= codersdk.WorkspaceProxyStatus{
@@ -246,14 +255,18 @@ func fakeWorkspaceProxy(name string, healthy bool, version string) codersdk.Work
246255
},
247256
}
248257
}
249-
return codersdk.WorkspaceProxy{
258+
wsp:= codersdk.WorkspaceProxy{
250259
Region: codersdk.Region{
251260
Name:name,
252261
Healthy:healthy,
253262
},
254263
Version:version,
255264
Status:status,
256265
}
266+
for_,f:=rangemutators {
267+
f(&wsp)
268+
}
269+
returnwsp
257270
}
258271

259272
funcfakeFetchWorkspaceProxies(ps...codersdk.WorkspaceProxy)func(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy],error) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp