diff options
author | Valery Piashchynski <[email protected]> | 2021-06-15 22:12:32 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-15 22:12:32 +0300 |
commit | d4c92e48bada7593b6fbec612a742c599de6e736 (patch) | |
tree | 53b6fb81987953b71a77ae094e579a0a7daa407c /plugins/jobs/event_test.go | |
parent | 9dc98d43b0c0de3e1e1bd8fdc97c122c7c7c594f (diff) |
- Jobs plugin initial commit
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/event_test.go')
-rw-r--r-- | plugins/jobs/event_test.go | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/plugins/jobs/event_test.go b/plugins/jobs/event_test.go new file mode 100644 index 00000000..94d53531 --- /dev/null +++ b/plugins/jobs/event_test.go @@ -0,0 +1,52 @@ +package jobs + +import ( + "errors" + "github.com/stretchr/testify/assert" + "testing" + "time" +) + +func TestJobEvent_Elapsed(t *testing.T) { + e := &JobEvent{ + ID: "id", + Job: &Job{}, + start: time.Now(), + elapsed: time.Millisecond, + } + + assert.Equal(t, time.Millisecond, e.Elapsed()) +} + +func TestJobError_Elapsed(t *testing.T) { + e := &JobError{ + ID: "id", + Job: &Job{}, + start: time.Now(), + elapsed: time.Millisecond, + } + + assert.Equal(t, time.Millisecond, e.Elapsed()) +} + +func TestJobError_Error(t *testing.T) { + e := &JobError{ + ID: "id", + Job: &Job{}, + start: time.Now(), + elapsed: time.Millisecond, + Caused: errors.New("error"), + } + + assert.Equal(t, time.Millisecond, e.Elapsed()) + assert.Equal(t, "error", e.Error()) +} + +func TestPipelineError_Error(t *testing.T) { + e := &PipelineError{ + Pipeline: &Pipeline{}, + Caused: errors.New("error"), + } + + assert.Equal(t, "error", e.Error()) +} |