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

Function TestTimeout

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

Source from the content-addressed store, hash-verified

100}
101
102func TestTimeout(t *testing.T) {
103 t.Parallel()
104 if runtime.GOOS == "darwin" {
105 t.Skip("this test is flaky on macOS, see https://github.com/coder/internal/issues/329")
106 }
107 runner := setup(t, nil)
108 defer runner.Close()
109 aAPI := agenttest.NewFakeAgentAPI(t, testutil.Logger(t), nil, nil)
110 err := runner.Init([]codersdk.WorkspaceAgentScript{{
111 LogSourceID: uuid.New(),
112 Script: "sleep infinity",
113 Timeout: 100 * time.Millisecond,
114 }}, aAPI.ScriptCompleted)
115 require.NoError(t, err)
116 require.ErrorIs(t, runner.Execute(context.Background(), agentscripts.ExecuteAllScripts), agentscripts.ErrTimeout)
117}
118
119func TestScriptReportsTiming(t *testing.T) {
120 t.Parallel()

Callers

nothing calls this directly

Calls 8

NewFakeAgentAPIFunction · 0.92
LoggerFunction · 0.92
SkipMethod · 0.80
setupFunction · 0.70
CloseMethod · 0.65
InitMethod · 0.65
NewMethod · 0.65
ExecuteMethod · 0.65

Tested by

no test coverage detected