Permalink
Browse files

requesting an op that isn't provided by anyone should fail

  • Loading branch information...
1 parent 43b8e84 commit c32cfa681dc2b85a670f1147aa95ebe5366377ad @outerim outerim committed May 22, 2009
Showing with 14 additions and 2 deletions.
  1. +6 −2 lib/pelvis/outcall.rb
  2. +8 −0 spec/request_spec.rb
View
@@ -34,7 +34,11 @@ def discover_with_herault
identities += data[:identities]
end
request.on_completed do |event|
- evoke_to(identities)
+ if identities.empty?
+ failed("No identities found to satisfy #{job.operation} with resources #{job.args[:resources]}")
+ else
+ evoke_to(identities)
+ end
end
request.on_failed do |error|
failed("Could not do discovery: #{error}")
@@ -106,7 +110,7 @@ def max_retries
def check_begun
return unless @all_sent
return if finished?
- if evocations.values.none? {|s| s == :created}
+ if evocations.values.any? {|s| s != :created}
logger.debug "All evocations are begun"
evoked
end
View
@@ -29,6 +29,14 @@
should_be_good(results)
end
+ it "errors when no identities are found for the op" do
+ results = TestDelegate.new
+ start_agents do |agent|
+ agent.request(:all, "/blabiddy", {:foo => 'bar'}, :delegate => results)
+ end
+ should_not_be_good(results)
+ end
+
it "errors when the remote end is down" do
#pending "This should call into the 'failed' callback"

0 comments on commit c32cfa6

Please sign in to comment.