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

Function setupWorkspaceForAgentWithName

codersdk/toolsdk/toolsdk_test.go:54–71  ·  view source on GitHub ↗

setupWorkspaceForAgentWithName creates a workspace setup exactly like main SSH tests, but with a caller-provided workspace name. nolint:gocritic // This is in a test package and does not end up in the build

(t *testing.T, opts *coderdtest.Options, workspaceName string)

Source from the content-addressed store, hash-verified

52// SSH tests, but with a caller-provided workspace name.
53// nolint:gocritic // This is in a test package and does not end up in the build
54func setupWorkspaceForAgentWithName(t *testing.T, opts *coderdtest.Options, workspaceName string) (*codersdk.Client, database.WorkspaceTable, string) {
55 t.Helper()
56
57 client, store := coderdtest.NewWithDatabase(t, opts)
58 client.SetLogger(testutil.Logger(t).Named("client"))
59 first := coderdtest.CreateFirstUser(t, client)
60 userClient, user := coderdtest.CreateAnotherUserMutators(t, client, first.OrganizationID, nil, func(r *codersdk.CreateUserRequestWithOrgs) {
61 r.Username = "myuser"
62 })
63 // nolint:gocritic // This is in a test package and does not end up in the build
64 r := dbfake.WorkspaceBuild(t, store, database.WorkspaceTable{
65 Name: workspaceName,
66 OrganizationID: first.OrganizationID,
67 OwnerID: user.ID,
68 }).WithAgent().Do()
69
70 return userClient, r.Workspace, r.AgentToken
71}
72
73type recordingAgentConnFunc struct {
74 conn workspacesdk.AgentConn

Callers 2

setupWorkspaceForAgentFunction · 0.85
TestToolsFunction · 0.85

Calls 10

NewWithDatabaseFunction · 0.92
LoggerFunction · 0.92
CreateFirstUserFunction · 0.92
WorkspaceBuildFunction · 0.92
NamedMethod · 0.80
WithAgentMethod · 0.80
HelperMethod · 0.65
SetLoggerMethod · 0.65
DoMethod · 0.65

Tested by

no test coverage detected