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

Function TestStart_Starting

cli/start_test.go:492–523  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

490}
491
492func TestStart_Starting(t *testing.T) {
493 t.Parallel()
494 ctx := testutil.Context(t, testutil.WaitShort)
495
496 store, ps := dbtestutil.NewDB(t)
497 client := coderdtest.New(t, &coderdtest.Options{Pubsub: ps, Database: store})
498 owner := coderdtest.CreateFirstUser(t, client)
499 memberClient, member := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)
500 r := dbfake.WorkspaceBuild(t, store, database.WorkspaceTable{
501 OwnerID: member.ID,
502 OrganizationID: owner.OrganizationID,
503 }).
504 Starting().
505 Do()
506
507 inv, root := clitest.New(t, "start", r.Workspace.Name)
508 clitest.SetupConfig(t, memberClient, root)
509 doneChan := make(chan struct{})
510 pty := ptytest.New(t).Attach(inv)
511 go func() {
512 defer close(doneChan)
513 err := inv.Run()
514 assert.NoError(t, err)
515 }()
516
517 pty.ExpectMatch("workspace is already starting")
518
519 _ = dbfake.JobComplete(t, store, r.Build.JobID).Pubsub(ps).Do()
520 pty.ExpectMatch("workspace has been started")
521
522 _ = testutil.TryReceive(ctx, t, doneChan)
523}
524
525func TestStart_NoWait(t *testing.T) {
526 t.Parallel()

Callers

nothing calls this directly

Calls 15

ContextFunction · 0.92
NewDBFunction · 0.92
NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateAnotherUserFunction · 0.92
WorkspaceBuildFunction · 0.92
NewFunction · 0.92
SetupConfigFunction · 0.92
NewFunction · 0.92
JobCompleteFunction · 0.92
TryReceiveFunction · 0.92
DoMethod · 0.65

Tested by

no test coverage detected