jason-o-matic-deep_test 1.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/CHANGELOG +47 -0
  2. data/README.rdoc +228 -0
  3. data/Rakefile +211 -0
  4. data/bin/deep_test +15 -0
  5. data/lib/deep_test.rb +90 -0
  6. data/lib/deep_test/database/mysql_setup_listener.rb +113 -0
  7. data/lib/deep_test/database/setup_listener.rb +116 -0
  8. data/lib/deep_test/deadlock_detector.rb +7 -0
  9. data/lib/deep_test/distributed/dispatch_controller.rb +53 -0
  10. data/lib/deep_test/distributed/drb_client_connection_info.rb +15 -0
  11. data/lib/deep_test/distributed/filename_resolver.rb +40 -0
  12. data/lib/deep_test/distributed/master_test_server.rb +52 -0
  13. data/lib/deep_test/distributed/multi_test_server_proxy.rb +44 -0
  14. data/lib/deep_test/distributed/null_work_unit.rb +12 -0
  15. data/lib/deep_test/distributed/remote_worker_client.rb +54 -0
  16. data/lib/deep_test/distributed/remote_worker_server.rb +111 -0
  17. data/lib/deep_test/distributed/rsync.rb +37 -0
  18. data/lib/deep_test/distributed/show_status.rhtml +41 -0
  19. data/lib/deep_test/distributed/test_server.rb +79 -0
  20. data/lib/deep_test/distributed/test_server_status.rb +9 -0
  21. data/lib/deep_test/distributed/test_server_workers.rb +24 -0
  22. data/lib/deep_test/distributed/throughput_runner.rb +42 -0
  23. data/lib/deep_test/distributed/throughput_statistics.rb +26 -0
  24. data/lib/deep_test/distributed/throughput_worker_client.rb +19 -0
  25. data/lib/deep_test/extensions/drb_extension.rb +34 -0
  26. data/lib/deep_test/extensions/object_extension.rb +40 -0
  27. data/lib/deep_test/listener_list.rb +17 -0
  28. data/lib/deep_test/local_workers.rb +55 -0
  29. data/lib/deep_test/logger.rb +17 -0
  30. data/lib/deep_test/marshallable_exception_wrapper.rb +44 -0
  31. data/lib/deep_test/metrics/gatherer.rb +67 -0
  32. data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +133 -0
  33. data/lib/deep_test/null_worker_listener.rb +65 -0
  34. data/lib/deep_test/option.rb +70 -0
  35. data/lib/deep_test/options.rb +112 -0
  36. data/lib/deep_test/process_orchestrator.rb +49 -0
  37. data/lib/deep_test/rake_tasks.rb +11 -0
  38. data/lib/deep_test/result_reader.rb +36 -0
  39. data/lib/deep_test/rspec_detector.rb +24 -0
  40. data/lib/deep_test/server.rb +75 -0
  41. data/lib/deep_test/spec.rb +12 -0
  42. data/lib/deep_test/spec/extensions/example_group_methods.rb +64 -0
  43. data/lib/deep_test/spec/extensions/example_methods.rb +46 -0
  44. data/lib/deep_test/spec/extensions/options.rb +43 -0
  45. data/lib/deep_test/spec/extensions/reporter.rb +29 -0
  46. data/lib/deep_test/spec/extensions/spec_task.rb +20 -0
  47. data/lib/deep_test/spec/runner.rb +57 -0
  48. data/lib/deep_test/spec/work_result.rb +33 -0
  49. data/lib/deep_test/spec/work_unit.rb +59 -0
  50. data/lib/deep_test/test.rb +10 -0
  51. data/lib/deep_test/test/extensions/error.rb +14 -0
  52. data/lib/deep_test/test/runner.rb +24 -0
  53. data/lib/deep_test/test/supervised_test_suite.rb +49 -0
  54. data/lib/deep_test/test/work_result.rb +34 -0
  55. data/lib/deep_test/test/work_unit.rb +40 -0
  56. data/lib/deep_test/test_task.rb +51 -0
  57. data/lib/deep_test/ui/console.rb +76 -0
  58. data/lib/deep_test/ui/null.rb +17 -0
  59. data/lib/deep_test/warlock.rb +134 -0
  60. data/lib/deep_test/worker.rb +57 -0
  61. data/script/internal/run_test_suite.rb +7 -0
  62. data/script/public/master_test_server.rb +24 -0
  63. data/script/public/test_server.rb +18 -0
  64. data/script/public/test_throughput.rb +29 -0
  65. data/test/deep_test/database/mysql_setup_listener_test.rb +14 -0
  66. data/test/deep_test/distributed/dispatch_controller_test.rb +209 -0
  67. data/test/deep_test/distributed/drb_client_connection_info_test.rb +42 -0
  68. data/test/deep_test/distributed/filename_resolver_test.rb +52 -0
  69. data/test/deep_test/distributed/master_test_server_test.rb +32 -0
  70. data/test/deep_test/distributed/multi_test_server_proxy_test.rb +96 -0
  71. data/test/deep_test/distributed/remote_worker_client_test.rb +180 -0
  72. data/test/deep_test/distributed/remote_worker_server_test.rb +107 -0
  73. data/test/deep_test/distributed/rsync_test.rb +67 -0
  74. data/test/deep_test/distributed/test_server_test.rb +94 -0
  75. data/test/deep_test/distributed/test_server_workers_test.rb +26 -0
  76. data/test/deep_test/distributed/throughput_runner_test.rb +68 -0
  77. data/test/deep_test/distributed/throughput_worker_client_test.rb +28 -0
  78. data/test/deep_test/extensions/object_extension_test.rb +37 -0
  79. data/test/deep_test/listener_list_test.rb +20 -0
  80. data/test/deep_test/local_workers_test.rb +22 -0
  81. data/test/deep_test/logger_test.rb +11 -0
  82. data/test/deep_test/marshallable_exception_wrapper_test.rb +44 -0
  83. data/test/deep_test/metrics/gatherer_test.rb +66 -0
  84. data/test/deep_test/process_orchestrator_test.rb +11 -0
  85. data/test/deep_test/result_reader_test.rb +128 -0
  86. data/test/deep_test/server_test.rb +58 -0
  87. data/test/deep_test/test/extensions/error_test.rb +40 -0
  88. data/test/deep_test/test/runner_test.rb +7 -0
  89. data/test/deep_test/test/supervised_test_suite_test.rb +79 -0
  90. data/test/deep_test/test/work_result_test.rb +81 -0
  91. data/test/deep_test/test/work_unit_test.rb +61 -0
  92. data/test/deep_test/test_task_test.rb +43 -0
  93. data/test/deep_test/ui/console_test.rb +9 -0
  94. data/test/deep_test/warlock_test.rb +38 -0
  95. data/test/deep_test/worker_test.rb +94 -0
  96. data/test/failing.rake +11 -0
  97. data/test/failing.rb +7 -0
  98. data/test/fake_deadlock_error.rb +12 -0
  99. data/test/simple_test_blackboard.rb +45 -0
  100. data/test/simple_test_blackboard_test.rb +33 -0
  101. data/test/test_factory.rb +74 -0
  102. data/test/test_helper.rb +15 -0
  103. data/test/test_task_test.rb +72 -0
  104. metadata +160 -0
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + "/../../lib/deep_test"
2
+ require 'drb/drb'
3
+ require 'optparse'
4
+
5
+ config = DeepTest::Distributed::TestServer.parse_args(ARGV)
6
+
7
+ #
8
+ # Clear args so they won't be processed in any forked processes.
9
+ # - When specs are loaded by the RemoteWorkerServer, RSpec
10
+ # attempts to parse ARGV
11
+ #
12
+ ARGV.clear
13
+
14
+ begin
15
+ DeepTest::Distributed::TestServer.start(config)
16
+ rescue Interrupt
17
+ DeepTest.logger.info "Exiting due to Interrupt"
18
+ end
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../../lib/deep_test'
2
+
3
+ unless ARGV.length == 2
4
+ puts "Usage: deep_test test_throughput <server uri> <test_count>"
5
+ exit(1)
6
+ end
7
+
8
+ uri = ARGV[0]
9
+ test_count = ARGV[1].to_i
10
+
11
+ options = DeepTest::Options.new(:distributed_server => uri,
12
+ :sync_options => {:source => ""})
13
+ server = DeepTest::Distributed::TestServer.connect options
14
+ workers = DeepTest::Distributed::ThroughputWorkerClient.new(options, server)
15
+ runner = DeepTest::Distributed::ThroughputRunner.new(options, test_count) do |result|
16
+ $stdout.print "."
17
+ $stdout.flush
18
+ end
19
+
20
+ start_time = Time.now
21
+ DeepTest::ProcessOrchestrator.new(options, workers, runner).run(false)
22
+ end_time = Time.now
23
+
24
+ puts
25
+ puts runner.statistics.summary
26
+
27
+ run_time = end_time.to_f - start_time.to_f
28
+ puts "Total Run Time: #{run_time} seconds"
29
+ puts "Run Time Not Spent On Tests: #{run_time - runner.statistics.timespan_in_seconds}"
@@ -0,0 +1,14 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "dump_schema includes procedures" do
5
+ listener = DeepTest::Database::MysqlSetupListener.new
6
+ listener.expects(:system).with do |command|
7
+ command =~ / -R /
8
+ end
9
+ listener.expects(:master_database_config).returns({})
10
+ listener.expects(:dump_file_name).returns("")
11
+ $?.expects(:success?).returns(true)
12
+ listener.dump_schema
13
+ end
14
+ end
@@ -0,0 +1,209 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "dispatch invokes each receiver once" do
5
+ receiver_1, receiver_2 = mock, mock
6
+
7
+ controller = DeepTest::Distributed::DispatchController.new(
8
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
9
+ [receiver_1, receiver_2]
10
+ )
11
+
12
+ receiver_1.expects(:a_method).with(:args)
13
+ receiver_2.expects(:a_method).with(:args)
14
+
15
+ controller.dispatch(:a_method, :args)
16
+ end
17
+
18
+ test "dispatch returns array of all results" do
19
+ receiver_1, receiver_2 = mock, mock
20
+
21
+ controller = DeepTest::Distributed::DispatchController.new(
22
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
23
+ [receiver_1, receiver_2]
24
+ )
25
+
26
+ receiver_1.expects(:a_method).returns(:result_1)
27
+ receiver_2.expects(:a_method).returns(:result_2)
28
+
29
+ results = controller.dispatch(:a_method)
30
+ assert_equal 2, results.size
31
+ assert_equal [:result_1, :result_2].to_set, results.to_set
32
+ end
33
+
34
+ test "dispatch calls all receivers in parallel" do
35
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
36
+ waiter = Waiter.new(tracker = Tracker.new)
37
+
38
+ Timeout.timeout(1) do
39
+ DeepTest::Distributed::DispatchController.new(options,[tracker, waiter]).
40
+ dispatch(:tracked_method)
41
+ end
42
+
43
+ waiter = Waiter.new(tracker = Tracker.new)
44
+
45
+ Timeout.timeout(1) do
46
+ DeepTest::Distributed::DispatchController.new(options,[waiter, tracker]).
47
+ dispatch(:tracked_method)
48
+ end
49
+ end
50
+
51
+ test "dispatch omits results that are taking too long" do
52
+ receiver = Object.new
53
+ def receiver.__drburi; ""; end
54
+ def receiver.sleep_100_millis
55
+ sleep 0.1
56
+ end
57
+
58
+ controller = DeepTest::Distributed::DispatchController.new(
59
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null", :timeout_in_seconds => 0.05}),
60
+ [receiver]
61
+ )
62
+
63
+ DeepTest.logger.expects(:error)
64
+
65
+ assert_equal [], controller.dispatch(:sleep_100_millis)
66
+ end
67
+
68
+ test "after timeout, no further calls are sent to that receiver" do
69
+ receiver_1, receiver_2 = mock(:__drburi => ""), mock
70
+ receiver_1.expects(:method_call_1).raises(Timeout::Error.new("message"))
71
+ receiver_1.expects(:method_call_2).never
72
+
73
+ receiver_2.expects(:method_call_1)
74
+ receiver_2.expects(:method_call_2)
75
+
76
+ controller = DeepTest::Distributed::DispatchController.new(
77
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null", :timeout_in_seconds => 0.05}),
78
+ [receiver_1, receiver_2]
79
+ )
80
+
81
+ DeepTest.logger.expects(:error)
82
+
83
+ controller.dispatch(:method_call_1)
84
+ controller.dispatch(:method_call_2)
85
+ end
86
+
87
+ test "receiver is dropped when connection is refused" do
88
+ receiver_1, receiver_2 = mock(:__drburi => ""), mock
89
+ receiver_1.expects(:method_call_1).raises(DRb::DRbConnError)
90
+ receiver_1.expects(:method_call_2).never
91
+
92
+ receiver_2.expects(:method_call_1).returns(:value)
93
+ receiver_2.expects(:method_call_2)
94
+
95
+ controller = DeepTest::Distributed::DispatchController.new(
96
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null", :timeout_in_seconds => 0.05}),
97
+ [receiver_1, receiver_2]
98
+ )
99
+
100
+ DeepTest.logger.expects(:error)
101
+
102
+ assert_equal [:value], controller.dispatch(:method_call_1)
103
+
104
+ controller.dispatch(:method_call_2)
105
+ end
106
+
107
+ test "receiver is dropped when any exception occurs" do
108
+ receiver = mock(:__drburi => "")
109
+ receiver.expects(:method_call).raises(Exception)
110
+
111
+ controller = DeepTest::Distributed::DispatchController.new(
112
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null", :timeout_in_seconds => 0.05}),
113
+ [receiver]
114
+ )
115
+
116
+ DeepTest.logger.expects(:error)
117
+
118
+ controller.dispatch(:method_call)
119
+ assert_raises(DeepTest::Distributed::NoDispatchReceiversError) {controller.dispatch(:another_call)}
120
+ end
121
+
122
+ test "no error is printed if dispatching without error" do
123
+ receiver_1 = mock
124
+ receiver_1.expects(:method_call_1).raises(DRb::DRbConnError)
125
+
126
+ controller = DeepTest::Distributed::DispatchController.new(
127
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null", :timeout_in_seconds => 0.05}),
128
+ [receiver_1]
129
+ )
130
+
131
+ DeepTest.logger.expects(:error).never
132
+
133
+ controller.dispatch_with_options(:method_call_1, :ignore_connection_error => true)
134
+ end
135
+
136
+ test "dispatch calls notifies ui of start and stop of dispatch" do
137
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
138
+ controller = DeepTest::Distributed::DispatchController.new(
139
+ options, [stub_everything]
140
+ )
141
+
142
+ options.ui_instance.expects(:dispatch_starting).with(:method_name)
143
+ options.ui_instance.expects(:dispatch_finished).with(:method_name)
144
+
145
+ controller.dispatch(:method_name)
146
+ end
147
+
148
+ test "dispatch calls notifies ui dispatch end in case of an error" do
149
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
150
+ controller = DeepTest::Distributed::DispatchController.new(
151
+ options, [receiver = mock(:__drburi => '')]
152
+ )
153
+ receiver.expects(:method_name).raises("An Error")
154
+ DeepTest.logger.expects(:error)
155
+
156
+ options.ui_instance.expects(:dispatch_starting).with(:method_name)
157
+ options.ui_instance.expects(:dispatch_finished).with(:method_name)
158
+
159
+ begin
160
+ controller.dispatch(:method_name)
161
+ rescue RuntimeError => e
162
+ raise unless e.message == "An Error"
163
+ end
164
+ end
165
+
166
+ test "error is raised if dispatch to no receivers in attempted" do
167
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
168
+ controller = DeepTest::Distributed::DispatchController.new(
169
+ options, []
170
+ )
171
+
172
+ assert_raises(DeepTest::Distributed::NoDispatchReceiversError) do
173
+ controller.dispatch(:any_method)
174
+ end
175
+ end
176
+
177
+ class Tracker
178
+ def initialize
179
+ @mutex = Mutex.new
180
+ @condvar = ConditionVariable.new
181
+ end
182
+
183
+ def tracked_method
184
+ @mutex.synchronize do
185
+ @tracked_method_called = true
186
+ @condvar.broadcast
187
+ end
188
+ end
189
+
190
+ def wait_for_tracked_method
191
+ @mutex.synchronize do
192
+ loop do
193
+ return if @tracked_method_called
194
+ @condvar.wait(@mutex)
195
+ end
196
+ end
197
+ end
198
+ end
199
+
200
+ class Waiter
201
+ def initialize(tracker)
202
+ @tracker = tracker
203
+ end
204
+
205
+ def tracked_method
206
+ @tracker.wait_for_tracked_method
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "returns ipaddress from peeraddr as address" do
5
+ info = Thread.current['DRb']
6
+ begin
7
+ Thread.current['DRb'] = {
8
+ 'client' => mock(:peeraddr => [nil, nil, nil, "ip"])
9
+ }
10
+
11
+ info = DeepTest::Distributed::DRbClientConnectionInfo.new
12
+ ensure
13
+ Thread.current['DRb'] = info
14
+ end
15
+
16
+ assert_equal "ip", info.address
17
+ end
18
+
19
+ test "raises an error if no drb client is found" do
20
+ info = Thread.current['DRb']
21
+ begin
22
+ Thread.current['DRb'] = {}
23
+ assert_raises(RuntimeError) do
24
+ DeepTest::Distributed::DRbClientConnectionInfo.new
25
+ end
26
+ ensure
27
+ Thread.current['DRb'] = info
28
+ end
29
+ end
30
+
31
+ test "raises an error if no drb info is found" do
32
+ info = Thread.current['DRb']
33
+ begin
34
+ Thread.current['DRb'] = nil
35
+ assert_raises(RuntimeError) do
36
+ DeepTest::Distributed::DRbClientConnectionInfo.new
37
+ end
38
+ ensure
39
+ Thread.current['DRb'] = info
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,52 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "should strip off directories until file exists in base path" do
5
+ resolver = DeepTest::Distributed::FilenameResolver.new("base_path")
6
+
7
+ File.expects(:exist?).with("base_path/a/b/c/d.rb").returns(false)
8
+ File.expects(:exist?).with("base_path/b/c/d.rb").returns(false)
9
+ File.expects(:exist?).with("base_path/c/d.rb").returns(true)
10
+
11
+ assert_equal "base_path/c/d.rb", resolver.resolve("/a/b/c/d.rb")
12
+ end
13
+
14
+ test "should resolve relative names starting at first element" do
15
+ resolver = DeepTest::Distributed::FilenameResolver.new("base_path")
16
+
17
+ File.expects(:exist?).with("base_path/a/b/c/d.rb").returns(true)
18
+
19
+ assert_equal "base_path/a/b/c/d.rb", resolver.resolve("a/b/c/d.rb")
20
+ end
21
+
22
+ test "should resolve relative names the same each time" do
23
+ resolver = DeepTest::Distributed::FilenameResolver.new("base_path")
24
+
25
+ File.expects(:exist?).with("base_path/a/b/c/d.rb").returns(true)
26
+
27
+ assert_equal "base_path/a/b/c/d.rb", resolver.resolve("a/b/c/d.rb")
28
+ assert_equal "base_path/a/b/c/d.rb", resolver.resolve("a/b/c/d.rb")
29
+ end
30
+
31
+ test "should raise exception if filename can't be resolved" do
32
+ resolver = DeepTest::Distributed::FilenameResolver.new("base_path")
33
+
34
+ File.expects(:exist?).with("base_path/a/b/c/d.rb").returns(false)
35
+ File.expects(:exist?).with("base_path/b/c/d.rb").returns(false)
36
+ File.expects(:exist?).with("base_path/c/d.rb").returns(false)
37
+ File.expects(:exist?).with("base_path/d.rb").returns(false)
38
+
39
+ assert_raises(RuntimeError) { resolver.resolve("/a/b/c/d.rb") }
40
+ end
41
+
42
+ test "should remember how many directories to strip off after first resolution" do
43
+ resolver = DeepTest::Distributed::FilenameResolver.new("base_path")
44
+
45
+ File.expects(:exist?).with("base_path/a/b/c/d.rb").returns(false)
46
+ File.expects(:exist?).with("base_path/b/c/d.rb").returns(true)
47
+
48
+ resolver.resolve("/a/b/c/d.rb")
49
+
50
+ assert_equal "base_path/x/y/z.rb", resolver.resolve("/a/x/y/z.rb")
51
+ end
52
+ end
@@ -0,0 +1,32 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "show_status renders status of all servers as html" do
5
+ status = DeepTest::Distributed::TestServerStatus.new(
6
+ "binding_uri",
7
+ 5,
8
+ 3
9
+ )
10
+
11
+ test_server = mock(:__drburi => "drburi_1", :status => status)
12
+ server = DeepTest::Distributed::MasterTestServer.new([test_server])
13
+ res = WEBrick::HTTPResponse.new(WEBrick::Config::HTTP)
14
+ server.show_status(:req, res)
15
+
16
+ assert_match "<td>binding_uri</td>", res.body
17
+ assert_match "<td>5</td>", res.body
18
+ assert_match "<td>3</td>", res.body
19
+ end
20
+
21
+ test "show_status display error message if exception occurs" do
22
+ test_server = mock(:__drburi => "drburi_1")
23
+ test_server.expects(:status).raises("An Error")
24
+
25
+ server = DeepTest::Distributed::MasterTestServer.new([test_server])
26
+
27
+ res = WEBrick::HTTPResponse.new(WEBrick::Config::HTTP)
28
+ server.show_status(:req, res)
29
+
30
+ assert_match /<td.*?>An Error<\/td>/, res.body
31
+ end
32
+ end
@@ -0,0 +1,96 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "sync is invoked on all servers" do
5
+ server_1, server_2 = mock, mock
6
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
7
+
8
+ master = DeepTest::Distributed::MultiTestServerProxy.new(options, [server_1, server_2])
9
+
10
+ server_1.expects(:sync).with(options)
11
+ server_2.expects(:sync).with(options)
12
+
13
+ master.sync(options)
14
+ end
15
+
16
+ test "spawn_worker_server is invoked on all server" do
17
+ server_1, server_2 = mock, mock
18
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
19
+
20
+ master = DeepTest::Distributed::MultiTestServerProxy.new(options, [server_1, server_2])
21
+
22
+ server_1.expects(:spawn_worker_server).with(options)
23
+ server_2.expects(:spawn_worker_server).with(options)
24
+
25
+ master.spawn_worker_server(options)
26
+ end
27
+
28
+ test "spawn_worker_server returns WorkerServerProxy with each worker" do
29
+ server_1 = mock(:spawn_worker_server => :worker_server_1)
30
+ server_2 = mock(:spawn_worker_server => :worker_server_2)
31
+ options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
32
+
33
+ master = DeepTest::Distributed::MultiTestServerProxy.new(options, [server_1, server_2])
34
+
35
+ DeepTest::Distributed::MultiTestServerProxy::WorkerServerProxy.
36
+ expects(:new).with(options, [:worker_server_1, :worker_server_2])
37
+
38
+ master.spawn_worker_server(options)
39
+ end
40
+
41
+ test "WorkerServerProxy dispatches start_all" do
42
+ server_1, server_2 = mock, mock
43
+
44
+ master = DeepTest::Distributed::MultiTestServerProxy::WorkerServerProxy.new(
45
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
46
+ [server_1, server_2]
47
+ )
48
+
49
+ server_1.expects(:start_all)
50
+ server_2.expects(:start_all)
51
+
52
+ master.start_all
53
+ end
54
+
55
+ test "WorkerServerProxy dispatches stop_all" do
56
+ server_1, server_2 = mock, mock
57
+
58
+ master = DeepTest::Distributed::MultiTestServerProxy::WorkerServerProxy.new(
59
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
60
+ [server_1, server_2]
61
+ )
62
+
63
+ server_1.expects(:stop_all)
64
+ server_2.expects(:stop_all)
65
+
66
+ master.stop_all
67
+ end
68
+
69
+ test "WorkerServerProxy stop_all ignores connection errors" do
70
+ server_1 = mock
71
+
72
+ master = DeepTest::Distributed::MultiTestServerProxy::WorkerServerProxy.new(
73
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
74
+ [server_1]
75
+ )
76
+
77
+ server_1.expects(:__drburi).never
78
+ server_1.expects(:stop_all).raises(DRb::DRbConnError)
79
+
80
+ master.stop_all
81
+ end
82
+
83
+ test "WorkerServerProxy dispatches load_files" do
84
+ server_1, server_2 = mock, mock
85
+
86
+ master = DeepTest::Distributed::MultiTestServerProxy::WorkerServerProxy.new(
87
+ DeepTest::Options.new({:ui => "DeepTest::UI::Null"}),
88
+ [server_1, server_2]
89
+ )
90
+
91
+ server_1.expects(:load_files).with(:filelist)
92
+ server_2.expects(:load_files).with(:filelist)
93
+
94
+ master.load_files :filelist
95
+ end
96
+ end