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

Function TestExecuteBasic

agent/agentscripts/agentscripts_test.go:31–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func 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
50func TestEnv(t *testing.T) {
51 t.Parallel()

Callers

nothing calls this directly

Calls 11

ContextFunction · 0.92
NewFakeAgentAPIFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
newFakeScriptLoggerFunction · 0.85
setupFunction · 0.70
CloseMethod · 0.65
InitMethod · 0.65
NewMethod · 0.65
ExecuteMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected