@@ -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- func fakeWorkspaceProxy (name string , healthy bool , version string ) codersdk.WorkspaceProxy {
248+ func fakeWorkspaceProxy (name string , healthy bool , version string , mutators ... func ( * codersdk. WorkspaceProxy ) ) codersdk.WorkspaceProxy {
240249 var status 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 := range mutators {
267+ f (& wsp )
268+ }
269+ return wsp
257270}
258271
259272func fakeFetchWorkspaceProxies (ps ... codersdk.WorkspaceProxy ) func (context.Context ) (codersdk.RegionsResponse [codersdk.WorkspaceProxy ], error ) {
0 commit comments