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

Function MustWorkspace

coderd/coderdtest/coderdtest.go:1490–1499  ·  view source on GitHub ↗

MustWorkspace is a convenience method for fetching a workspace that should exist.

(t testing.TB, client *codersdk.Client, workspaceID uuid.UUID)

Source from the content-addressed store, hash-verified

1488
1489// MustWorkspace is a convenience method for fetching a workspace that should exist.
1490func MustWorkspace(t testing.TB, client *codersdk.Client, workspaceID uuid.UUID) codersdk.Workspace {
1491 t.Helper()
1492 ctx := context.Background()
1493 ws, err := client.Workspace(ctx, workspaceID)
1494 if err != nil && strings.Contains(err.Error(), "status code 410") {
1495 ws, err = client.DeletedWorkspace(ctx, workspaceID)
1496 }
1497 require.NoError(t, err, "no workspace found with id %s", workspaceID)
1498 return ws
1499}
1500
1501// RequestExternalAuthCallback makes a request with the proper OAuth2 state cookie
1502// to the external auth callback endpoint.

Calls 5

WorkspaceMethod · 0.80
DeletedWorkspaceMethod · 0.80
HelperMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45