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

fix(coderd/healthcheck): ignore deleted wsproxies in wsproxy healthcheck#11515

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 2 commits intomainfromcj/healthcheck-wsproxy-ignore-deleted
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletioncoderd/healthcheck/workspaceproxy.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,7 +76,11 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo
return
}

r.WorkspaceProxies = proxies
for _, proxy := range proxies.Regions {
if !proxy.Deleted {
r.WorkspaceProxies.Regions = append(r.WorkspaceProxies.Regions, proxy)
}
}
if r.WorkspaceProxies.Regions == nil {
r.WorkspaceProxies.Regions = make([]codersdk.WorkspaceProxy, 0)
}
Expand Down
17 changes: 15 additions & 2 deletionscoderd/healthcheck/workspaceproxy_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,6 +164,15 @@ func TestWorkspaceProxies(t *testing.T) {
expectedSeverity: health.SeverityWarning,
expectedWarningCode: health.CodeProxyUpdate,
},
{
name: "Enabled/OneUnhealthyAndDeleted",
fetchWorkspaceProxies: fakeFetchWorkspaceProxies(fakeWorkspaceProxy("alpha", false, currentVersion, func(wp *codersdk.WorkspaceProxy) {
wp.Deleted = true
})),
updateProxyHealth: fakeUpdateProxyHealth(nil),
expectedHealthy: true,
expectedSeverity: health.SeverityOK,
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
Expand DownExpand Up@@ -236,7 +245,7 @@ func (u *fakeWorkspaceProxyFetchUpdater) Update(ctx context.Context) error {
}

//nolint:revive // yes, this is a control flag, and that is OK in a unit test.
func fakeWorkspaceProxy(name string, healthy bool, version string) codersdk.WorkspaceProxy {
func fakeWorkspaceProxy(name string, healthy bool, version string, mutators ...func(*codersdk.WorkspaceProxy)) codersdk.WorkspaceProxy {
var status codersdk.WorkspaceProxyStatus
if !healthy {
status = codersdk.WorkspaceProxyStatus{
Expand All@@ -246,14 +255,18 @@ func fakeWorkspaceProxy(name string, healthy bool, version string) codersdk.Work
},
}
}
return codersdk.WorkspaceProxy{
wsp := codersdk.WorkspaceProxy{
Region: codersdk.Region{
Name: name,
Healthy: healthy,
},
Version: version,
Status: status,
}
for _, f := range mutators {
f(&wsp)
}
return wsp
}

func fakeFetchWorkspaceProxies(ps ...codersdk.WorkspaceProxy) func(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error) {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp