(t *testing.T)
| 29 | } |
| 30 | |
| 31 | func TestExecuteBasic(t *testing.T) { |
| 32 | t.Parallel() |
| 33 | ctx := testutil.Context(t, testutil.WaitShort) |
| 34 | fLogger := newFakeScriptLogger() |
| 35 | runner := setup(t, func(uuid2 uuid.UUID) agentscripts.ScriptLogger { |
| 36 | return fLogger |
| 37 | }) |
| 38 | defer runner.Close() |
| 39 | aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil) |
| 40 | err := runner.Init([]codersdk.WorkspaceAgentScript{{ |
| 41 | LogSourceID: uuid.New(), |
| 42 | Script: "echo hello", |
| 43 | }}, aAPI.ScriptCompleted) |
| 44 | require.NoError(t, err) |
| 45 | require.NoError(t, runner.Execute(context.Background(), agentscripts.ExecuteAllScripts)) |
| 46 | log := testutil.TryReceive(ctx, t, fLogger.logs) |
| 47 | require.Equal(t, "hello", log.Output) |
| 48 | } |
| 49 | |
| 50 | func TestEnv(t *testing.T) { |
| 51 | t.Parallel() |
nothing calls this directly
no test coverage detected