taskinator 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -8
- data/lib/taskinator/process.rb +4 -0
- data/lib/taskinator/queues/delayed_job.rb +6 -3
- data/lib/taskinator/queues/resque.rb +7 -5
- data/lib/taskinator/queues/sidekiq.rb +7 -20
- data/lib/taskinator/task.rb +4 -0
- data/lib/taskinator/version.rb +1 -1
- data/spec/examples/queue_adapter_examples.rb +3 -3
- data/spec/spec_helper.rb +9 -1
- data/spec/support/delayed_job.rb +13 -0
- data/spec/support/sidekiq_matchers.rb +43 -0
- data/spec/taskinator/queues/delayed_job_spec.rb +22 -8
- data/spec/taskinator/queues/resque_spec.rb +38 -4
- data/spec/taskinator/queues/sidekiq_spec.rb +36 -11
- data/taskinator.gemspec +7 -4
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc6244f01294aaf18ec4f1236e7c77f1ed0ef79a
|
4
|
+
data.tar.gz: ba1c09e29ee13118858d9af4e149002a94361018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4130f514ee353149642139cf6c1aac940850c697a42018d5204db7361dc9918f49d270ffb678fd9c99d9c9e53ffe6aea7598f522dd8d7620ec02e40ba58fead1
|
7
|
+
data.tar.gz: 79f411acfc01f1da54bd639f323c93c442312ee374de99b3228c67ebdb4ca0cd8f6b6cb295c329ef54493b3ba2f0793e3a2dc709044be284ed0f1e1c7712a746
|
data/Gemfile.lock
CHANGED
@@ -8,11 +8,11 @@ GIT
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
taskinator (0.0.
|
12
|
-
connection_pool (>= 2.
|
13
|
-
json (>= 1.8.
|
14
|
-
redis (>= 3.
|
15
|
-
redis-namespace (>= 1.
|
11
|
+
taskinator (0.0.15)
|
12
|
+
connection_pool (>= 2.2.0)
|
13
|
+
json (>= 1.8.2)
|
14
|
+
redis (>= 3.2.1)
|
15
|
+
redis-namespace (>= 1.5.2)
|
16
16
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
@@ -48,8 +48,8 @@ GEM
|
|
48
48
|
i18n (0.7.0)
|
49
49
|
json (1.8.2)
|
50
50
|
method_source (0.8.2)
|
51
|
-
mime-types (2.
|
52
|
-
minitest (5.
|
51
|
+
mime-types (2.6.1)
|
52
|
+
minitest (5.7.0)
|
53
53
|
mono_logger (1.1.0)
|
54
54
|
multi_json (1.11.0)
|
55
55
|
netrc (0.10.3)
|
@@ -94,6 +94,9 @@ GEM
|
|
94
94
|
rspec-mocks (3.2.1)
|
95
95
|
diff-lcs (>= 1.2.0, < 2.0)
|
96
96
|
rspec-support (~> 3.2.0)
|
97
|
+
rspec-sidekiq (2.0.0)
|
98
|
+
rspec (~> 3.0, >= 3.0.0)
|
99
|
+
sidekiq (>= 2.4.0)
|
97
100
|
rspec-support (3.2.2)
|
98
101
|
sidekiq (3.3.4)
|
99
102
|
celluloid (>= 0.16.0)
|
@@ -118,7 +121,7 @@ GEM
|
|
118
121
|
tilt (2.0.1)
|
119
122
|
timers (4.0.1)
|
120
123
|
hitimes
|
121
|
-
tins (1.5.
|
124
|
+
tins (1.5.2)
|
122
125
|
tzinfo (1.2.2)
|
123
126
|
thread_safe (~> 0.1)
|
124
127
|
unf (0.1.4)
|
@@ -140,6 +143,7 @@ DEPENDENCIES
|
|
140
143
|
resque (>= 1.25.2)
|
141
144
|
resque_spec (>= 0.16.0)
|
142
145
|
rspec
|
146
|
+
rspec-sidekiq (>= 2.0.0)
|
143
147
|
sidekiq (>= 3.0.0)
|
144
148
|
taskinator!
|
145
149
|
workflow!
|
data/lib/taskinator/process.rb
CHANGED
@@ -17,16 +17,19 @@ module Taskinator
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def enqueue_process(process)
|
20
|
-
|
20
|
+
queue = process.queue || @config[:process_queue]
|
21
|
+
::Delayed::Job.enqueue ProcessWorker.new(process.uuid), :queue => queue
|
21
22
|
end
|
22
23
|
|
23
24
|
def enqueue_task(task)
|
24
|
-
|
25
|
+
queue = task.queue || @config[:task_queue]
|
26
|
+
::Delayed::Job.enqueue TaskWorker.new(task.uuid), :queue => queue
|
25
27
|
end
|
26
28
|
|
27
29
|
def enqueue_job(job)
|
28
30
|
# delayed jobs don't define the queue so use the configured queue instead
|
29
|
-
|
31
|
+
queue = job.queue || @config[:job_queue]
|
32
|
+
::Delayed::Job.enqueue JobWorker.new(job.uuid), :queue => queue
|
30
33
|
end
|
31
34
|
|
32
35
|
ProcessWorker = Struct.new(:process_uuid) do
|
@@ -29,17 +29,19 @@ module Taskinator
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def enqueue_process(process)
|
32
|
-
Resque.
|
32
|
+
queue = process.queue || Resque.queue_from_class(ProcessWorker)
|
33
|
+
Resque.enqueue_to(queue, ProcessWorker, process.uuid)
|
33
34
|
end
|
34
35
|
|
35
36
|
def enqueue_task(task)
|
36
|
-
Resque.
|
37
|
+
queue = task.queue || Resque.queue_from_class(TaskWorker)
|
38
|
+
Resque.enqueue_to(queue, TaskWorker, task.uuid)
|
37
39
|
end
|
38
40
|
|
39
41
|
def enqueue_job(job)
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
queue = job.queue ||
|
43
|
+
Resque.queue_from_class(job.job) ||
|
44
|
+
Resque.queue_from_class(JobWorker)
|
43
45
|
|
44
46
|
Resque.enqueue_to(queue, JobWorker, job.uuid)
|
45
47
|
end
|
@@ -9,39 +9,26 @@ module Taskinator
|
|
9
9
|
|
10
10
|
class SidekiqAdapter
|
11
11
|
def initialize(config={})
|
12
|
-
config = {
|
12
|
+
@config = {
|
13
13
|
:process_queue => :default,
|
14
14
|
:task_queue => :default,
|
15
15
|
:job_queue => :default
|
16
16
|
}.merge(config)
|
17
|
-
|
18
|
-
ProcessWorker.class_eval do
|
19
|
-
sidekiq_options :queue => config[:process_queue]
|
20
|
-
end
|
21
|
-
|
22
|
-
TaskWorker.class_eval do
|
23
|
-
sidekiq_options :queue => config[:task_queue]
|
24
|
-
end
|
25
|
-
|
26
|
-
JobWorker.class_eval do
|
27
|
-
sidekiq_options :queue => config[:job_queue]
|
28
|
-
end
|
29
17
|
end
|
30
18
|
|
31
19
|
def enqueue_process(process)
|
32
|
-
|
20
|
+
queue = process.queue || @config[:process_queue]
|
21
|
+
ProcessWorker.client_push('class' => ProcessWorker, 'args' => [process.uuid], 'queue' => queue)
|
33
22
|
end
|
34
23
|
|
35
24
|
def enqueue_task(task)
|
36
|
-
|
25
|
+
queue = task.queue || @config[:task_queue]
|
26
|
+
TaskWorker.client_push('class' => TaskWorker, 'args' => [task.uuid], 'queue' => queue)
|
37
27
|
end
|
38
28
|
|
39
29
|
def enqueue_job(job)
|
40
|
-
|
41
|
-
|
42
|
-
JobWorker.get_sidekiq_options.merge!('queue' => queue) if queue
|
43
|
-
|
44
|
-
JobWorker.perform_async(job.uuid)
|
30
|
+
queue = job.queue || job.job.get_sidekiq_options[:queue] || @config[:job_queue]
|
31
|
+
JobWorker.client_push('class' => JobWorker, 'args' => [job.uuid], 'queue' => queue)
|
45
32
|
end
|
46
33
|
|
47
34
|
class ProcessWorker
|
data/lib/taskinator/task.rb
CHANGED
data/lib/taskinator/version.rb
CHANGED
@@ -15,7 +15,7 @@ shared_examples_for "a queue adapter" do |adapter_name, adapter_type|
|
|
15
15
|
|
16
16
|
it "should enqueue a process" do
|
17
17
|
expect {
|
18
|
-
subject.enqueue_process(double('process', :uuid => 'xx-xx-xx-xx'))
|
18
|
+
subject.enqueue_process(double('process', :uuid => 'xx-xx-xx-xx', :queue => nil))
|
19
19
|
}.to_not raise_error
|
20
20
|
end
|
21
21
|
end
|
@@ -25,7 +25,7 @@ shared_examples_for "a queue adapter" do |adapter_name, adapter_type|
|
|
25
25
|
|
26
26
|
it "should enqueue a task" do
|
27
27
|
expect {
|
28
|
-
subject.enqueue_task(double('task', :uuid => 'xx-xx-xx-xx'))
|
28
|
+
subject.enqueue_task(double('task', :uuid => 'xx-xx-xx-xx', :queue => nil))
|
29
29
|
}.to_not raise_error
|
30
30
|
end
|
31
31
|
end
|
@@ -35,7 +35,7 @@ shared_examples_for "a queue adapter" do |adapter_name, adapter_type|
|
|
35
35
|
|
36
36
|
it "should enqueue a job" do
|
37
37
|
expect {
|
38
|
-
subject.enqueue_job(double('job', :uuid => 'xx-xx-xx-xx', :job => job))
|
38
|
+
subject.enqueue_job(double('job', :uuid => 'xx-xx-xx-xx', :job => job, :queue => nil))
|
39
39
|
}.to_not raise_error
|
40
40
|
end
|
41
41
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,7 @@ end
|
|
17
17
|
require 'delayed_job'
|
18
18
|
|
19
19
|
require 'sidekiq'
|
20
|
-
require 'sidekiq
|
20
|
+
require 'rspec-sidekiq'
|
21
21
|
Sidekiq::Testing.fake!
|
22
22
|
|
23
23
|
require 'resque'
|
@@ -53,6 +53,14 @@ RSpec.configure do |config|
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
config.before(:each, :sidekiq => true) do
|
57
|
+
Sidekiq::Worker.clear_all
|
58
|
+
end
|
59
|
+
|
60
|
+
config.before(:each, :delayed_job => true) do
|
61
|
+
Delayed::Job.clear_all
|
62
|
+
end
|
63
|
+
|
56
64
|
end
|
57
65
|
|
58
66
|
# require examples, must happen after configure
|
data/spec/support/delayed_job.rb
CHANGED
@@ -5,8 +5,21 @@ module Delayed
|
|
5
5
|
@queue ||= []
|
6
6
|
end
|
7
7
|
|
8
|
+
def self.clear_all
|
9
|
+
@queue = []
|
10
|
+
end
|
11
|
+
|
8
12
|
def self.enqueue(*args)
|
9
13
|
queue << args
|
10
14
|
end
|
15
|
+
|
16
|
+
# NOTE: expects only one job in the queue, so don't forget to clear down the fake queue before each spec
|
17
|
+
def self.contains?(job_class, args=nil, queue_name=:default)
|
18
|
+
entry = queue.first
|
19
|
+
entry &&
|
20
|
+
(entry.first.class == job_class) &&
|
21
|
+
(entry.first.to_a == [*args]) &&
|
22
|
+
(entry.last[:queue] == queue_name)
|
23
|
+
end
|
11
24
|
end
|
12
25
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Sidekiq
|
3
|
+
module Matchers
|
4
|
+
|
5
|
+
#
|
6
|
+
# original version here:
|
7
|
+
# https://github.com/philostler/rspec-sidekiq/blob/develop/lib/rspec/sidekiq/matchers/be_processed_in.rb
|
8
|
+
#
|
9
|
+
# this matcher needs to read off the actual queue name used, from the job array
|
10
|
+
# instead of reading off the job classes configuration
|
11
|
+
#
|
12
|
+
|
13
|
+
def be_processed_in_x(expected_queue)
|
14
|
+
BeProcessedInX.new expected_queue
|
15
|
+
end
|
16
|
+
|
17
|
+
class BeProcessedInX
|
18
|
+
def initialize(expected_queue)
|
19
|
+
@expected_queue = expected_queue
|
20
|
+
end
|
21
|
+
|
22
|
+
def description
|
23
|
+
"be processed in the \"#{@expected_queue}\" queue"
|
24
|
+
end
|
25
|
+
|
26
|
+
def failure_message
|
27
|
+
"expected #{@klass} to be processed in the \"#{@expected_queue}\" queue but got \"#{@actual}\""
|
28
|
+
end
|
29
|
+
|
30
|
+
# NOTE: expects only one job in the queue, so don't forget to clear down the fake queue before each spec
|
31
|
+
def matches?(job)
|
32
|
+
@klass = job.is_a?(Class) ? job : job.class
|
33
|
+
entry = @klass.jobs.first
|
34
|
+
entry && (entry['queue'] == @expected_queue.to_s)
|
35
|
+
end
|
36
|
+
|
37
|
+
def failure_message_when_negated
|
38
|
+
"expected #{@klass} to not be processed in the \"#{@expected_queue}\" queue"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Taskinator::Queues::DelayedJobAdapter do
|
3
|
+
describe Taskinator::Queues::DelayedJobAdapter, :delayed_job do
|
4
4
|
|
5
5
|
it_should_behave_like "a queue adapter", :delayed_job, Taskinator::Queues::DelayedJobAdapter
|
6
6
|
|
@@ -11,12 +11,16 @@ describe Taskinator::Queues::DelayedJobAdapter do
|
|
11
11
|
|
12
12
|
describe "ProcessWorker" do
|
13
13
|
it "enqueues processes" do
|
14
|
-
worker = adapter::ProcessWorker
|
15
14
|
expect {
|
16
|
-
subject.enqueue_process(double('process', :uuid => uuid))
|
15
|
+
subject.enqueue_process(double('process', :uuid => uuid, :queue => nil))
|
17
16
|
}.to change(Delayed::Job.queue, :size).by(1)
|
18
17
|
end
|
19
18
|
|
19
|
+
it "enqueues process to specified queue" do
|
20
|
+
subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
|
21
|
+
expect(Delayed::Job.contains?(adapter::ProcessWorker, uuid, :other)).to be
|
22
|
+
end
|
23
|
+
|
20
24
|
it "calls process worker" do
|
21
25
|
expect_any_instance_of(Taskinator::ProcessWorker).to receive(:perform)
|
22
26
|
adapter::ProcessWorker.new(uuid).perform
|
@@ -25,12 +29,16 @@ describe Taskinator::Queues::DelayedJobAdapter do
|
|
25
29
|
|
26
30
|
describe "TaskWorker" do
|
27
31
|
it "enqueues tasks" do
|
28
|
-
worker = adapter::TaskWorker
|
29
32
|
expect {
|
30
|
-
subject.
|
33
|
+
subject.enqueue_task(double('task', :uuid => uuid, :queue => nil))
|
31
34
|
}.to change(Delayed::Job.queue, :size).by(1)
|
32
35
|
end
|
33
36
|
|
37
|
+
it "enqueues task to specified queue" do
|
38
|
+
subject.enqueue_task(double('task', :uuid => uuid, :queue => :other))
|
39
|
+
expect(Delayed::Job.contains?(adapter::TaskWorker, uuid, :other)).to be
|
40
|
+
end
|
41
|
+
|
34
42
|
it "calls task worker" do
|
35
43
|
expect_any_instance_of(Taskinator::TaskWorker).to receive(:perform)
|
36
44
|
adapter::TaskWorker.new(uuid).perform
|
@@ -39,16 +47,22 @@ describe Taskinator::Queues::DelayedJobAdapter do
|
|
39
47
|
|
40
48
|
describe "JobWorker" do
|
41
49
|
it "enqueues jobs" do
|
42
|
-
worker = adapter::JobWorker
|
43
|
-
|
44
50
|
job = double('job')
|
45
|
-
job_task = double('job_task', :uuid => uuid, :job => job)
|
51
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => nil)
|
46
52
|
|
47
53
|
expect {
|
48
54
|
subject.enqueue_job(job_task)
|
49
55
|
}.to change(Delayed::Job.queue, :size).by(1)
|
50
56
|
end
|
51
57
|
|
58
|
+
it "enqueues job to specified queue" do
|
59
|
+
job = double('job')
|
60
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => :other)
|
61
|
+
subject.enqueue_job(job_task)
|
62
|
+
|
63
|
+
expect(Delayed::Job.contains?(adapter::JobWorker, uuid, :other)).to be
|
64
|
+
end
|
65
|
+
|
52
66
|
it "calls job worker" do
|
53
67
|
expect_any_instance_of(Taskinator::JobWorker).to receive(:perform)
|
54
68
|
adapter::JobWorker.new(uuid).perform
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Taskinator::Queues::ResqueAdapter do
|
3
|
+
describe Taskinator::Queues::ResqueAdapter, :resque do
|
4
4
|
|
5
5
|
it_should_behave_like "a queue adapter", :resque, Taskinator::Queues::ResqueAdapter
|
6
6
|
|
@@ -12,11 +12,18 @@ describe Taskinator::Queues::ResqueAdapter do
|
|
12
12
|
describe "ProcessWorker" do
|
13
13
|
it "enqueues processes" do
|
14
14
|
worker = adapter::ProcessWorker
|
15
|
-
subject.enqueue_process(double('process', :uuid => uuid))
|
15
|
+
subject.enqueue_process(double('process', :uuid => uuid, :queue => nil))
|
16
16
|
|
17
17
|
expect(worker).to have_queued(uuid)
|
18
18
|
end
|
19
19
|
|
20
|
+
it "enqueues process to specified queue" do
|
21
|
+
worker = adapter::ProcessWorker
|
22
|
+
subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
|
23
|
+
|
24
|
+
expect(worker).to have_queued(uuid).in(:other)
|
25
|
+
end
|
26
|
+
|
20
27
|
it "calls process worker" do
|
21
28
|
expect_any_instance_of(Taskinator::ProcessWorker).to receive(:perform)
|
22
29
|
adapter::ProcessWorker.perform(uuid)
|
@@ -26,11 +33,18 @@ describe Taskinator::Queues::ResqueAdapter do
|
|
26
33
|
describe "TaskWorker" do
|
27
34
|
it "enqueues tasks" do
|
28
35
|
worker = adapter::TaskWorker
|
29
|
-
subject.enqueue_task(double('task', :uuid => uuid))
|
36
|
+
subject.enqueue_task(double('task', :uuid => uuid, :queue => nil))
|
30
37
|
|
31
38
|
expect(worker).to have_queued(uuid)
|
32
39
|
end
|
33
40
|
|
41
|
+
it "enqueues task to specified queue" do
|
42
|
+
worker = adapter::TaskWorker
|
43
|
+
subject.enqueue_task(double('task', :uuid => uuid, :queue => :other))
|
44
|
+
|
45
|
+
expect(worker).to have_queued(uuid).in(:other)
|
46
|
+
end
|
47
|
+
|
34
48
|
it "calls task worker" do
|
35
49
|
expect_any_instance_of(Taskinator::TaskWorker).to receive(:perform)
|
36
50
|
adapter::TaskWorker.perform(uuid)
|
@@ -42,12 +56,32 @@ describe Taskinator::Queues::ResqueAdapter do
|
|
42
56
|
worker = adapter::JobWorker
|
43
57
|
|
44
58
|
job = double('job')
|
45
|
-
job_task = double('job_task', :uuid => uuid, :job => job)
|
59
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => nil)
|
46
60
|
|
47
61
|
subject.enqueue_job(job_task)
|
48
62
|
expect(worker).to have_queued(uuid)
|
49
63
|
end
|
50
64
|
|
65
|
+
it "enqueues job to queue of the job class" do
|
66
|
+
worker = adapter::JobWorker
|
67
|
+
|
68
|
+
job = double('job', :queue => :job)
|
69
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => nil)
|
70
|
+
|
71
|
+
subject.enqueue_job(job_task)
|
72
|
+
expect(worker).to have_queued(uuid).in(:job)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "enqueues job to specified queue" do
|
76
|
+
worker = adapter::JobWorker
|
77
|
+
|
78
|
+
job = double('job')
|
79
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => :other)
|
80
|
+
|
81
|
+
subject.enqueue_job(job_task)
|
82
|
+
expect(worker).to have_queued(uuid).in(:other)
|
83
|
+
end
|
84
|
+
|
51
85
|
it "calls job worker" do
|
52
86
|
expect_any_instance_of(Taskinator::JobWorker).to receive(:perform)
|
53
87
|
adapter::JobWorker.perform(uuid)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Taskinator::Queues::SidekiqAdapter do
|
3
|
+
describe Taskinator::Queues::SidekiqAdapter, :sidekiq do
|
4
4
|
|
5
5
|
it_should_behave_like "a queue adapter", :sidekiq, Taskinator::Queues::SidekiqAdapter do
|
6
6
|
let(:job) { double('job', :get_sidekiq_options => {}) }
|
@@ -14,9 +14,14 @@ describe Taskinator::Queues::SidekiqAdapter do
|
|
14
14
|
describe "ProcessWorker" do
|
15
15
|
it "enqueues processes" do
|
16
16
|
worker = adapter::ProcessWorker
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
process = double('process', :uuid => uuid, :queue => nil)
|
18
|
+
subject.enqueue_process(process)
|
19
|
+
expect(worker).to have_enqueued_job(process.uuid)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "enqueues process to specified queue" do
|
23
|
+
subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
|
24
|
+
expect(adapter::ProcessWorker).to be_processed_in_x(:other)
|
20
25
|
end
|
21
26
|
|
22
27
|
it "calls process worker" do
|
@@ -28,9 +33,14 @@ describe Taskinator::Queues::SidekiqAdapter do
|
|
28
33
|
describe "TaskWorker" do
|
29
34
|
it "enqueues tasks" do
|
30
35
|
worker = adapter::TaskWorker
|
31
|
-
|
32
|
-
|
33
|
-
|
36
|
+
task = double('task', :uuid => uuid, :queue => nil)
|
37
|
+
subject.enqueue_task(task)
|
38
|
+
expect(worker).to have_enqueued_job(task.uuid)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "enqueues task to specified queue" do
|
42
|
+
subject.enqueue_task(double('task', :uuid => uuid, :queue => :other))
|
43
|
+
expect(adapter::TaskWorker).to be_processed_in_x(:other)
|
34
44
|
end
|
35
45
|
|
36
46
|
it "calls task worker" do
|
@@ -44,11 +54,26 @@ describe Taskinator::Queues::SidekiqAdapter do
|
|
44
54
|
worker = adapter::JobWorker
|
45
55
|
|
46
56
|
job = double('job', :get_sidekiq_options => {})
|
47
|
-
job_task = double('job_task', :uuid => uuid, :job => job)
|
57
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => nil)
|
58
|
+
|
59
|
+
subject.enqueue_job(job_task)
|
60
|
+
expect(worker).to have_enqueued_job(job_task.uuid)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "enqueues job to queue of the job class" do
|
64
|
+
job = double('job', :get_sidekiq_options => {:queue => :job})
|
65
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => nil)
|
66
|
+
subject.enqueue_job(job_task)
|
67
|
+
|
68
|
+
expect(adapter::JobWorker).to be_processed_in_x(:job)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "enqueues job to specified queue" do
|
72
|
+
job = double('job', :get_sidekiq_options => {})
|
73
|
+
job_task = double('job_task', :uuid => uuid, :job => job, :queue => :other)
|
74
|
+
subject.enqueue_job(job_task)
|
48
75
|
|
49
|
-
expect
|
50
|
-
subject.enqueue_job(job_task)
|
51
|
-
}.to change(worker.jobs, :size).by(1)
|
76
|
+
expect(adapter::JobWorker).to be_processed_in_x(:other)
|
52
77
|
end
|
53
78
|
|
54
79
|
it "calls job worker" do
|
data/taskinator.gemspec
CHANGED
@@ -21,16 +21,19 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.required_ruby_version = '>= 2.0.0'
|
22
22
|
|
23
23
|
# core
|
24
|
-
spec.add_dependency 'redis', '>= 3.
|
25
|
-
spec.add_dependency 'redis-namespace', '>= 1.
|
26
|
-
spec.add_dependency 'connection_pool', '>= 2.
|
27
|
-
spec.add_dependency 'json', '>= 1.8.
|
24
|
+
spec.add_dependency 'redis', '>= 3.2.1'
|
25
|
+
spec.add_dependency 'redis-namespace', '>= 1.5.2'
|
26
|
+
spec.add_dependency 'connection_pool', '>= 2.2.0'
|
27
|
+
spec.add_dependency 'json', '>= 1.8.2'
|
28
28
|
|
29
29
|
# spec.add_dependency 'workflow', '>= 1.3.0' # RubyGems not up to date as of 11 Nov 2014.
|
30
30
|
|
31
31
|
# queues
|
32
32
|
spec.add_development_dependency 'sidekiq', '>= 3.0.0'
|
33
|
+
spec.add_development_dependency 'rspec-sidekiq', '>= 2.0.0'
|
34
|
+
|
33
35
|
spec.add_development_dependency 'delayed_job', '>= 4.0.0'
|
36
|
+
|
34
37
|
spec.add_development_dependency 'resque', '>= 1.25.2'
|
35
38
|
spec.add_development_dependency 'resque_spec', '>= 0.16.0'
|
36
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Stefano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.2.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.2.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis-namespace
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.5.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.5.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: connection_pool
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.2.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.8.
|
61
|
+
version: 1.8.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.8.
|
68
|
+
version: 1.8.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sidekiq
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-sidekiq
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: delayed_job
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,6 +266,7 @@ files:
|
|
252
266
|
- spec/examples/task_examples.rb
|
253
267
|
- spec/spec_helper.rb
|
254
268
|
- spec/support/delayed_job.rb
|
269
|
+
- spec/support/sidekiq_matchers.rb
|
255
270
|
- spec/support/spec_support.rb
|
256
271
|
- spec/support/test_flow.rb
|
257
272
|
- spec/support/test_queue.rb
|
@@ -306,6 +321,7 @@ test_files:
|
|
306
321
|
- spec/examples/task_examples.rb
|
307
322
|
- spec/spec_helper.rb
|
308
323
|
- spec/support/delayed_job.rb
|
324
|
+
- spec/support/sidekiq_matchers.rb
|
309
325
|
- spec/support/spec_support.rb
|
310
326
|
- spec/support/test_flow.rb
|
311
327
|
- spec/support/test_queue.rb
|