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

Function TestScriptCompleted

coderd/agentapi/scripts_test.go:20–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func TestScriptCompleted(t *testing.T) {
21 t.Parallel()
22
23 tests := []struct {
24 scriptID uuid.UUID
25 timing *agentproto.Timing
26 expectInsert bool
27 expectError string
28 }{
29 {
30 scriptID: uuid.New(),
31 timing: &agentproto.Timing{
32 Stage: agentproto.Timing_START,
33 Start: timestamppb.New(dbtime.Now()),
34 End: timestamppb.New(dbtime.Now().Add(time.Second)),
35 Status: agentproto.Timing_OK,
36 ExitCode: 0,
37 },
38 expectInsert: true,
39 },
40 {
41 scriptID: uuid.New(),
42 timing: &agentproto.Timing{
43 Stage: agentproto.Timing_STOP,
44 Start: timestamppb.New(dbtime.Now()),
45 End: timestamppb.New(dbtime.Now().Add(time.Second)),
46 Status: agentproto.Timing_OK,
47 ExitCode: 0,
48 },
49 expectInsert: true,
50 },
51 {
52 scriptID: uuid.New(),
53 timing: &agentproto.Timing{
54 Stage: agentproto.Timing_CRON,
55 Start: timestamppb.New(dbtime.Now()),
56 End: timestamppb.New(dbtime.Now().Add(time.Second)),
57 Status: agentproto.Timing_OK,
58 ExitCode: 0,
59 },
60 expectInsert: true,
61 },
62 {
63 scriptID: uuid.New(),
64 timing: &agentproto.Timing{
65 Stage: agentproto.Timing_START,
66 Start: timestamppb.New(dbtime.Now()),
67 End: timestamppb.New(dbtime.Now().Add(time.Second)),
68 Status: agentproto.Timing_TIMED_OUT,
69 ExitCode: 255,
70 },
71 expectInsert: true,
72 },
73 {
74 scriptID: uuid.New(),
75 timing: &agentproto.Timing{
76 Stage: agentproto.Timing_START,
77 Start: timestamppb.New(dbtime.Now()),

Callers

nothing calls this directly

Calls 11

EXPECTMethod · 0.95
ScriptCompletedMethod · 0.95
NowFunction · 0.92
NewMockStoreFunction · 0.92
NewMethod · 0.65
AddMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected