MCPcopy Create free account
hub / github.com/coder/coder / setupRunnerTest

Function setupRunnerTest

scaletest/agentconn/run_test.go:221–262  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

219}
220
221func setupRunnerTest(t *testing.T) (client *codersdk.Client, agentID uuid.UUID) {
222 t.Helper()
223
224 client = coderdtest.New(t, &coderdtest.Options{
225 IncludeProvisionerDaemon: true,
226 })
227 user := coderdtest.CreateFirstUser(t, client)
228
229 authToken := uuid.NewString()
230 version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
231 Parse: echo.ParseComplete,
232 ProvisionPlan: echo.PlanComplete,
233 ProvisionGraph: []*proto.Response{{
234 Type: &proto.Response_Graph{
235 Graph: &proto.GraphComplete{
236 Resources: []*proto.Resource{{
237 Name: "example",
238 Type: "aws_instance",
239 Agents: []*proto.Agent{{
240 Id: uuid.NewString(),
241 Name: "agent",
242 Auth: &proto.Agent_Token{
243 Token: authToken,
244 },
245 Apps: []*proto.App{},
246 }},
247 }},
248 },
249 },
250 }},
251 })
252
253 template := coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
254 coderdtest.AwaitTemplateVersionJobCompleted(t, client, version.ID)
255
256 workspace := coderdtest.CreateWorkspace(t, client, template.ID)
257 coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, workspace.LatestBuild.ID)
258
259 _ = agenttest.New(t, client.URL, authToken)
260 resources := coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
261 return client, resources[0].Agents[0].ID
262}
263
264func testServer(t *testing.T) (string, func() int64) {
265 t.Helper()

Callers 2

Test_RunnerFunction · 0.70
Test_Runner_TimingFunction · 0.70

Calls 10

NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateTemplateVersionFunction · 0.92
CreateTemplateFunction · 0.92
CreateWorkspaceFunction · 0.92
NewFunction · 0.92
AwaitWorkspaceAgentsFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected