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

Function setupCLITaskTestWithoutSnapshot

cli/task_test.go:406–416  ·  view source on GitHub ↗

setupCLITaskTestWithoutSnapshot creates a task in the specified status without a log snapshot. Note: We do not use IncludeProvisionerDaemon because these tests use dbfake to directly set up database state and don't need actual provisioning. This also avoids potential interference from the provisione

(t *testing.T, status codersdk.TaskStatus)

Source from the content-addressed store, hash-verified

404// set up database state and don't need actual provisioning. This also avoids potential
405// interference from the provisioner daemon polling for jobs.
406func setupCLITaskTestWithoutSnapshot(t *testing.T, status codersdk.TaskStatus) (*codersdk.Client, codersdk.Task) {
407 t.Helper()
408
409 ownerClient, db := coderdtest.NewWithDatabase(t, nil)
410 owner := coderdtest.CreateFirstUser(t, ownerClient)
411 userClient, user := coderdtest.CreateAnotherUser(t, ownerClient, owner.OrganizationID)
412
413 task := createTaskInStatus(t, db, owner.OrganizationID, user.ID, status)
414
415 return userClient, task
416}
417
418// createTaskInStatus creates a task in the specified status using dbfake.
419func createTaskInStatus(t *testing.T, db database.Store, orgID, ownerID uuid.UUID, status codersdk.TaskStatus) codersdk.Task {

Callers 1

Test_TaskLogs_GoldenFunction · 0.85

Calls 5

NewWithDatabaseFunction · 0.92
CreateFirstUserFunction · 0.92
CreateAnotherUserFunction · 0.92
createTaskInStatusFunction · 0.85
HelperMethod · 0.65

Tested by

no test coverage detected