Permalink
Browse files

more test cases for clustering

  • Loading branch information...
1 parent 7f0ebd0 commit cb5ce36829e2747d4a9407308731fede0723c16a @gnufied committed Sep 6, 2008
Showing with 15 additions and 1 deletion.
  1. +1 −1 lib/backgroundrb/rails_worker_proxy.rb
  2. +14 −0 test/client/test_worker_proxy.rb
@@ -57,7 +57,7 @@ def run_method host_info,method_name,worker_options = {}
elsif host_info == :all
succeeded = false
begin
- connection.each { |conn| result << invoke_on_connection(connection,method_name,worker_options) }
+ connection.each { |conn| result << invoke_on_connection(conn,method_name,worker_options) }
succeeded = true
rescue BdrbConnError; end
raise NoServerAvailable.new("No BackgrounDRb server is found running") unless succeeded
@@ -84,4 +84,18 @@
end
@worker_proxy.deq_foobar(:job_key => "catz")
end
+
+ specify "should run task on all servers if asked" do
+ backend_connections = []
+ 2.times { |i|
+ actual_conn = mock()
+ actual_conn.expects(:ask_work).with(:worker => :hello_worker,:worker_method => 'foobar',:job_key => 'hello')
+ backend_connections << actual_conn
+ }
+ @cluster_conn.expects(:backend_connections).returns(backend_connections)
+ a = @worker_proxy.async_foobar(:job_key => "hello",:host => :all)
+ end
+
+ specify "should switch connections if invoke fails on chosen one" do
+ end
end

0 comments on commit cb5ce36

Please sign in to comment.