Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix tests

  • Loading branch information...
commit f1f42a2ac9f3e20b93ef240558b8f2c5dd063ba6 1 parent 44358ae
Evan Weaver authored
View
2  VERSION
@@ -1 +1 @@
-0.5.3
+0.5.4
View
2  lib/kestrel/client/transactional.rb
@@ -46,7 +46,7 @@ def get(key, opts = {})
queue = (rand < @error_rate) ? key + "_errors" : key
- if job = get(queue, opts.merge(:open => true))
+ if job = client.get(queue, opts.merge(:open => true))
@current_queue = key
@job = job.is_a?(RetryableJob) ? job : RetryableJob.new(0, job)
@job.job
View
21 spec/kestrel/client/transactional_spec.rb
@@ -12,7 +12,7 @@
describe "#get" do
it "asks for a transaction" do
- mock(@raw_kestrel_client).get(@queue, :open => true, :close => true) { :mcguffin }
+ mock(@raw_kestrel_client).get(@queue, :open => true) { :mcguffin }
@kestrel.get(@queue).should == :mcguffin
end
@@ -23,13 +23,6 @@
@kestrel.get(@queue).should == :mcguffin
end
- it "falls through to the normal queue when error queue is empty" do
- mock(@kestrel).rand { Kestrel::Client::Transactional::ERROR_PROCESSING_RATE - 0.05 }
- mock(@raw_kestrel_client).get(@queue + "_errors", anything) { nil }
- mock(@raw_kestrel_client).get(@queue, anything) { :mcguffin }
- @kestrel.get(@queue).should == :mcguffin
- end
-
it "gets from the normal queue most of the time" do
mock(@kestrel).rand { Kestrel::Client::Transactional::ERROR_PROCESSING_RATE + 0.05 }
mock(@raw_kestrel_client).get(@queue, anything) { :mcguffin }
@@ -37,16 +30,16 @@
@kestrel.get(@queue).should == :mcguffin
end
- it "falls through to the error queue when normal queue is empty" do
+ it "is nil when the primary queue is empty and selected" do
mock(@kestrel).rand { Kestrel::Client::Transactional::ERROR_PROCESSING_RATE + 0.05 }
mock(@raw_kestrel_client).get(@queue, anything) { nil }
- mock(@raw_kestrel_client).get(@queue + "_errors", anything) { :mcguffin }
- @kestrel.get(@queue).should == :mcguffin
+ mock(@raw_kestrel_client).get(@queue + "_errors", anything).never
+ @kestrel.get(@queue).should be_nil
end
- it "is nil when both queues are empty" do
- mock(@kestrel).rand { Kestrel::Client::Transactional::ERROR_PROCESSING_RATE + 0.05 }
- mock(@raw_kestrel_client).get(@queue, anything) { nil }
+ it "is nil when the error queue is empty and selected" do
+ mock(@kestrel).rand { Kestrel::Client::Transactional::ERROR_PROCESSING_RATE - 0.05 }
+ mock(@raw_kestrel_client).get(@queue, anything).never
mock(@raw_kestrel_client).get(@queue + "_errors", anything) { nil }
@kestrel.get(@queue).should be_nil
end
Please sign in to comment.
Something went wrong with that request. Please try again.