(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func Test_TaskSend(t *testing.T) { |
| 28 | t.Parallel() |
| 29 | |
| 30 | t.Run("ByTaskName_WithArgument", func(t *testing.T) { |
| 31 | t.Parallel() |
| 32 | |
| 33 | setupCtx := testutil.Context(t, testutil.WaitLong) |
| 34 | setup := setupCLITaskTest(setupCtx, t, fakeAgentAPITaskSendOK(t, "carry on with the task", "you got it")) |
| 35 | |
| 36 | var stdout strings.Builder |
| 37 | inv, root := clitest.New(t, "task", "send", setup.task.Name, "carry on with the task") |
| 38 | inv.Stdout = &stdout |
| 39 | clitest.SetupConfig(t, setup.userClient, root) |
| 40 | |
| 41 | ctx := testutil.Context(t, testutil.WaitLong) |
| 42 | err := inv.WithContext(ctx).Run() |
| 43 | require.NoError(t, err) |
| 44 | }) |
| 45 | |
| 46 | t.Run("ByTaskID_WithArgument", func(t *testing.T) { |
| 47 | t.Parallel() |
| 48 | |
| 49 | setupCtx := testutil.Context(t, testutil.WaitLong) |
| 50 | setup := setupCLITaskTest(setupCtx, t, fakeAgentAPITaskSendOK(t, "carry on with the task", "you got it")) |
| 51 | |
| 52 | var stdout strings.Builder |
| 53 | inv, root := clitest.New(t, "task", "send", setup.task.ID.String(), "carry on with the task") |
| 54 | inv.Stdout = &stdout |
| 55 | clitest.SetupConfig(t, setup.userClient, root) |
| 56 | |
| 57 | ctx := testutil.Context(t, testutil.WaitLong) |
| 58 | err := inv.WithContext(ctx).Run() |
| 59 | require.NoError(t, err) |
| 60 | }) |
| 61 | |
| 62 | t.Run("ByTaskName_WithStdin", func(t *testing.T) { |
| 63 | t.Parallel() |
| 64 | |
| 65 | setupCtx := testutil.Context(t, testutil.WaitLong) |
| 66 | setup := setupCLITaskTest(setupCtx, t, fakeAgentAPITaskSendOK(t, "carry on with the task", "you got it")) |
| 67 | |
| 68 | var stdout strings.Builder |
| 69 | inv, root := clitest.New(t, "task", "send", setup.task.Name, "--stdin") |
| 70 | inv.Stdout = &stdout |
| 71 | inv.Stdin = strings.NewReader("carry on with the task") |
| 72 | clitest.SetupConfig(t, setup.userClient, root) |
| 73 | |
| 74 | ctx := testutil.Context(t, testutil.WaitLong) |
| 75 | err := inv.WithContext(ctx).Run() |
| 76 | require.NoError(t, err) |
| 77 | }) |
| 78 | |
| 79 | t.Run("TaskNotFound_ByName", func(t *testing.T) { |
| 80 | t.Parallel() |
| 81 | ctx := testutil.Context(t, testutil.WaitLong) |
| 82 | |
| 83 | client := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true}) |
| 84 | owner := coderdtest.CreateFirstUser(t, client) |
nothing calls this directly
no test coverage detected