(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func 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()), |
nothing calls this directly
no test coverage detected