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)
| 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 |
| 54 | func 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 | |
| 73 | type recordingAgentConnFunc struct { |
| 74 | conn workspacesdk.AgentConn |
no test coverage detected