MCPcopy Index your code
hub / github.com/coder/coder / fakeWorkspaceProxy

Function fakeWorkspaceProxy

coderd/healthcheck/workspaceproxy_test.go:247–268  ·  view source on GitHub ↗

nolint:revive // yes, this is a control flag, and that is OK in a unit test.

(name string, healthy bool, mutators ...func(*codersdk.WorkspaceProxy))

Source from the content-addressed store, hash-verified

245
246//nolint:revive // yes, this is a control flag, and that is OK in a unit test.
247func fakeWorkspaceProxy(name string, healthy bool, mutators ...func(*codersdk.WorkspaceProxy)) codersdk.WorkspaceProxy {
248 var status codersdk.WorkspaceProxyStatus
249 if !healthy {
250 status = codersdk.WorkspaceProxyStatus{
251 Status: codersdk.ProxyUnreachable,
252 Report: codersdk.ProxyHealthReport{
253 Errors: []string{assert.AnError.Error()},
254 },
255 }
256 }
257 wsp := codersdk.WorkspaceProxy{
258 Region: codersdk.Region{
259 Name: name,
260 Healthy: healthy,
261 },
262 Status: status,
263 }
264 for _, f := range mutators {
265 f(&wsp)
266 }
267 return wsp
268}
269
270func fakeFetchWorkspaceProxies(ps ...codersdk.WorkspaceProxy) func(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error) {
271 return func(context.Context) (codersdk.RegionsResponse[codersdk.WorkspaceProxy], error) {

Callers 1

TestWorkspaceProxiesFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected