(t *testing.T)
| 490 | } |
| 491 | |
| 492 | func 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 | |
| 525 | func TestStart_NoWait(t *testing.T) { |
| 526 | t.Parallel() |
nothing calls this directly
no test coverage detected