diff options
author | Valery Piashchynski <[email protected]> | 2021-08-29 23:46:11 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-08-29 23:46:11 +0300 |
commit | c23a88a943b53b99d112b63ed121931d1f79436f (patch) | |
tree | 5373bb61fec4ceb5db041f7207cec7ef115388d1 /plugins/jobs/job/job_test.go | |
parent | 22e17a99fe2087f9c11a438e877afbac0096c052 (diff) |
Implement Init, FromPipeline methods
Update receiver in the amqp driver
Add simple (initial) boltdb tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/job/job_test.go')
-rw-r--r-- | plugins/jobs/job/job_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/plugins/jobs/job/job_test.go b/plugins/jobs/job/job_test.go new file mode 100644 index 00000000..a47151a3 --- /dev/null +++ b/plugins/jobs/job/job_test.go @@ -0,0 +1,45 @@ +package job + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +func TestOptions_DelayDuration(t *testing.T) { + opts := &Options{Delay: 0} + assert.Equal(t, time.Duration(0), opts.DelayDuration()) +} + +func TestOptions_DelayDuration2(t *testing.T) { + opts := &Options{Delay: 1} + assert.Equal(t, time.Second, opts.DelayDuration()) +} + +func TestOptions_Merge(t *testing.T) { + opts := &Options{} + + opts.Merge(&Options{ + Pipeline: "pipeline", + Delay: 2, + }) + + assert.Equal(t, "pipeline", opts.Pipeline) + assert.Equal(t, int64(2), opts.Delay) +} + +func TestOptions_MergeKeepOriginal(t *testing.T) { + opts := &Options{ + Pipeline: "default", + Delay: 10, + } + + opts.Merge(&Options{ + Pipeline: "pipeline", + Delay: 2, + }) + + assert.Equal(t, "default", opts.Pipeline) + assert.Equal(t, int64(10), opts.Delay) +} |