jstorimer-deep-test 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/.gitignore +1 -0
  2. data/README.rdoc +41 -70
  3. data/Rakefile +47 -119
  4. data/TODO +2 -2
  5. data/VERSION +1 -1
  6. data/infrastructure/dynamic_teardown.rb +22 -0
  7. data/{test → infrastructure}/fake_deadlock_error.rb +0 -0
  8. data/infrastructure/load.rb +11 -0
  9. data/infrastructure/test_central_command.rb +15 -0
  10. data/infrastructure/test_exception.rb +7 -0
  11. data/{test → infrastructure}/test_factory.rb +0 -0
  12. data/infrastructure/test_logger.rb +11 -0
  13. data/infrastructure/test_operator.rb +15 -0
  14. data/infrastructure/test_result.rb +15 -0
  15. data/infrastructure/thread_agent.rb +21 -0
  16. data/infrastructure/timewarp/Rakefile +14 -0
  17. data/infrastructure/timewarp/lib/timewarp.rb +21 -0
  18. data/infrastructure/timewarp/test/timewarp_test.rb +45 -0
  19. data/lib/deep_test.rb +28 -40
  20. data/lib/deep_test/agent.rb +108 -0
  21. data/lib/deep_test/central_command.rb +165 -0
  22. data/lib/deep_test/cpu_info.rb +22 -0
  23. data/lib/deep_test/database/mysql_setup_listener.rb +11 -12
  24. data/lib/deep_test/database/setup_listener.rb +23 -23
  25. data/lib/deep_test/demon.rb +25 -0
  26. data/lib/deep_test/distributed/beachhead.rb +104 -0
  27. data/lib/deep_test/distributed/dispatch_controller.rb +17 -10
  28. data/lib/deep_test/distributed/establish_beachhead.rb +19 -0
  29. data/lib/deep_test/distributed/landing_fleet.rb +30 -0
  30. data/lib/deep_test/distributed/landing_ship.rb +60 -0
  31. data/lib/deep_test/distributed/remote_deployment.rb +56 -0
  32. data/lib/deep_test/distributed/rsync.rb +25 -12
  33. data/lib/deep_test/distributed/shell_environment.rb +50 -0
  34. data/lib/deep_test/distributed/ssh_client_connection_info.rb +14 -0
  35. data/lib/deep_test/failure_message.rb +19 -0
  36. data/lib/deep_test/lib_root.rb +4 -0
  37. data/lib/deep_test/listener_list.rb +1 -1
  38. data/lib/deep_test/local_deployment.rb +46 -0
  39. data/lib/deep_test/logger.rb +17 -2
  40. data/lib/deep_test/main.rb +41 -0
  41. data/lib/deep_test/marshallable_exception_wrapper.rb +4 -4
  42. data/lib/deep_test/metrics/data.rb +34 -0
  43. data/lib/deep_test/metrics/measurement.rb +39 -0
  44. data/lib/deep_test/{null_worker_listener.rb → null_listener.rb} +14 -14
  45. data/lib/deep_test/options.rb +41 -56
  46. data/lib/deep_test/proxy_io.rb +77 -0
  47. data/lib/deep_test/rake_tasks.rb +3 -1
  48. data/lib/deep_test/result_reader.rb +10 -6
  49. data/lib/deep_test/rspec_detector.rb +1 -1
  50. data/lib/deep_test/spec.rb +5 -1
  51. data/lib/deep_test/spec/extensions/example_methods.rb +7 -1
  52. data/lib/deep_test/spec/extensions/spec_task.rb +3 -2
  53. data/lib/deep_test/spec/runner.rb +32 -17
  54. data/lib/deep_test/spec/work_result.rb +2 -0
  55. data/lib/deep_test/test/run_test_suite.rb +5 -0
  56. data/lib/deep_test/test/runner.rb +2 -2
  57. data/lib/deep_test/test/supervised_test_suite.rb +9 -10
  58. data/lib/deep_test/test/work_result.rb +1 -0
  59. data/lib/deep_test/test_task.rb +1 -1
  60. data/lib/deep_test/ui/console.rb +9 -11
  61. data/lib/deep_test/warlock.rb +37 -25
  62. data/lib/telegraph.rb +29 -0
  63. data/lib/telegraph/ack_sequence.rb +14 -0
  64. data/lib/telegraph/logging.rb +20 -0
  65. data/lib/telegraph/message.rb +39 -0
  66. data/lib/telegraph/operator.rb +47 -0
  67. data/lib/telegraph/switchboard.rb +57 -0
  68. data/lib/telegraph/wire.rb +73 -0
  69. data/negative_acceptance_tests/dying_spec.rb +13 -0
  70. data/negative_acceptance_tests/dying_test.rb +13 -0
  71. data/negative_acceptance_tests/failing_spec.rb +9 -0
  72. data/{test/failing.rb → negative_acceptance_tests/failing_test.rb} +3 -1
  73. data/negative_acceptance_tests/kill_agent_one_on_start_work.rb +16 -0
  74. data/negative_acceptance_tests/passing_spec.rb +10 -0
  75. data/negative_acceptance_tests/passing_test.rb +12 -0
  76. data/negative_acceptance_tests/tasks.rake +87 -0
  77. data/negative_acceptance_tests/tests.rb +60 -0
  78. data/sample_rails_project/deep_test.rb +4 -0
  79. data/sample_rails_project/lib/{foreign_host_worker_simulation_listener.rb → foreign_host_agent_simulation_listener.rb} +6 -4
  80. data/sample_rails_project/lib/tasks/deep_test.rake +13 -4
  81. data/spec/deep_test/options_spec.rb +80 -59
  82. data/spec/deep_test/spec/extensions/example_methods_spec.rb +5 -4
  83. data/spec/deep_test/spec/extensions/spec_task_spec.rb +4 -6
  84. data/spec/deep_test/spec/runner_spec.rb +59 -32
  85. data/spec/spec_helper.rb +14 -6
  86. data/test/deep_test/agent_test.rb +175 -0
  87. data/test/deep_test/central_command_test.rb +147 -0
  88. data/test/deep_test/cpu_info_test.rb +33 -0
  89. data/test/deep_test/database/mysql_setup_listener_test.rb +13 -9
  90. data/test/deep_test/demon_test.rb +23 -0
  91. data/test/deep_test/distributed/beachhead_test.rb +67 -0
  92. data/test/deep_test/distributed/dispatch_controller_test.rb +130 -177
  93. data/test/deep_test/distributed/filename_resolver_test.rb +38 -34
  94. data/test/deep_test/distributed/landing_fleet_test.rb +55 -0
  95. data/test/deep_test/distributed/landing_ship_test.rb +48 -0
  96. data/test/deep_test/distributed/remote_deployment_test.rb +134 -0
  97. data/test/deep_test/distributed/rsync_test.rb +42 -62
  98. data/test/deep_test/distributed/shell_environment_fixtures/set_bar_to_foo +1 -0
  99. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_bar +1 -0
  100. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_baz +1 -0
  101. data/test/deep_test/distributed/shell_environment_test.rb +108 -0
  102. data/test/deep_test/distributed/ssh_client_connection_info_test.rb +34 -0
  103. data/test/deep_test/listener_list_test.rb +17 -15
  104. data/test/deep_test/local_deployment_test.rb +19 -0
  105. data/test/deep_test/logger_test.rb +34 -7
  106. data/test/deep_test/main_test.rb +12 -0
  107. data/test/deep_test/marshallable_exception_wrapper_test.rb +31 -29
  108. data/test/deep_test/metrics/data_test.rb +22 -0
  109. data/test/deep_test/metrics/measurement_test.rb +18 -0
  110. data/test/deep_test/proxy_io_test.rb +104 -0
  111. data/test/deep_test/result_reader_test.rb +95 -95
  112. data/test/deep_test/test/extensions/error_test.rb +38 -36
  113. data/test/deep_test/test/runner_test.rb +7 -3
  114. data/test/deep_test/test/supervised_test_suite_test.rb +89 -61
  115. data/test/deep_test/test/work_result_test.rb +80 -76
  116. data/test/deep_test/test/work_unit_test.rb +53 -51
  117. data/test/deep_test/test_task_test.rb +10 -38
  118. data/test/deep_test/ui/console_test.rb +8 -4
  119. data/test/deep_test/warlock_test.rb +33 -31
  120. data/test/test_helper.rb +20 -5
  121. data/test/test_task_test.rb +60 -57
  122. metadata +94 -84
  123. data/bin/deep_test +0 -15
  124. data/jstorimer-deep-test-0.1.0.gem +0 -0
  125. data/jstorimer-deep-test.gemspec +0 -1425
  126. data/lib/deep_test/distributed/drb_client_connection_info.rb +0 -15
  127. data/lib/deep_test/distributed/master_test_server.rb +0 -52
  128. data/lib/deep_test/distributed/multi_test_server_proxy.rb +0 -44
  129. data/lib/deep_test/distributed/null_work_unit.rb +0 -12
  130. data/lib/deep_test/distributed/remote_worker_client.rb +0 -54
  131. data/lib/deep_test/distributed/remote_worker_server.rb +0 -82
  132. data/lib/deep_test/distributed/show_status.rhtml +0 -41
  133. data/lib/deep_test/distributed/test_server.rb +0 -78
  134. data/lib/deep_test/distributed/test_server_status.rb +0 -9
  135. data/lib/deep_test/distributed/test_server_workers.rb +0 -24
  136. data/lib/deep_test/distributed/throughput_runner.rb +0 -42
  137. data/lib/deep_test/distributed/throughput_statistics.rb +0 -26
  138. data/lib/deep_test/distributed/throughput_worker_client.rb +0 -19
  139. data/lib/deep_test/extensions/drb_extension.rb +0 -34
  140. data/lib/deep_test/local_workers.rb +0 -55
  141. data/lib/deep_test/metrics/gatherer.rb +0 -67
  142. data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +0 -133
  143. data/lib/deep_test/option.rb +0 -60
  144. data/lib/deep_test/process_orchestrator.rb +0 -49
  145. data/lib/deep_test/server.rb +0 -75
  146. data/lib/deep_test/spec/extensions/reporter.rb +0 -29
  147. data/lib/deep_test/worker.rb +0 -57
  148. data/script/internal/run_test_suite.rb +0 -7
  149. data/script/public/master_test_server.rb +0 -24
  150. data/script/public/test_server.rb +0 -18
  151. data/script/public/test_throughput.rb +0 -29
  152. data/spec/deep_test/option_spec.rb +0 -33
  153. data/spec/thread_worker.rb +0 -25
  154. data/test/deep_test/distributed/drb_client_connection_info_test.rb +0 -42
  155. data/test/deep_test/distributed/master_test_server_test.rb +0 -32
  156. data/test/deep_test/distributed/multi_test_server_proxy_test.rb +0 -96
  157. data/test/deep_test/distributed/remote_worker_client_test.rb +0 -180
  158. data/test/deep_test/distributed/remote_worker_server_test.rb +0 -99
  159. data/test/deep_test/distributed/test_server_test.rb +0 -94
  160. data/test/deep_test/distributed/test_server_workers_test.rb +0 -26
  161. data/test/deep_test/distributed/throughput_runner_test.rb +0 -68
  162. data/test/deep_test/distributed/throughput_worker_client_test.rb +0 -28
  163. data/test/deep_test/local_workers_test.rb +0 -22
  164. data/test/deep_test/metrics/gatherer_test.rb +0 -66
  165. data/test/deep_test/process_orchestrator_test.rb +0 -11
  166. data/test/deep_test/server_test.rb +0 -58
  167. data/test/deep_test/worker_test.rb +0 -94
  168. data/test/failing.rake +0 -11
  169. data/test/simple_test_blackboard.rb +0 -45
  170. data/test/simple_test_blackboard_test.rb +0 -33
@@ -1,180 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../test_helper"
2
-
3
- unit_tests do
4
- test "load_files broadcasts before_sync" do
5
- class FakeListener; end
6
- client = DeepTest::Distributed::RemoteWorkerClient.new(
7
- options = DeepTest::Options.new(:worker_listener => FakeListener,
8
- :sync_options => {:source => "/tmp"}),
9
- test_server = stub_everything(:spawn_worker_server => stub_everything),
10
- failover_workers = mock
11
- )
12
- FakeListener.any_instance.expects(:before_sync)
13
- client.expects(:load)
14
- client.load_files ["filelist"]
15
-
16
- end
17
-
18
- test "load_files syncs the mirror" do
19
- client = DeepTest::Distributed::RemoteWorkerClient.new(
20
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}),
21
- test_server = stub_everything(:spawn_worker_server => stub_everything),
22
- failover_workers = mock
23
- )
24
-
25
- test_server.expects(:sync).with(options)
26
- client.expects(:load)
27
- client.load_files ["filelist"]
28
- end
29
-
30
- test "load_files loads files on worker server" do
31
- worker_server = stub_everything
32
- client = DeepTest::Distributed::RemoteWorkerClient.new(
33
- DeepTest::Options.new(:sync_options => {:source => "/tmp"}),
34
- test_server = stub_everything(:spawn_worker_server => worker_server),
35
- failover_workers = mock
36
- )
37
-
38
- worker_server.expects(:load_files).with(["filelist"])
39
- client.expects(:load)
40
- client.load_files ["filelist"]
41
- end
42
-
43
- test "load_files loads files locally" do
44
- worker_server = stub_everything
45
- client = DeepTest::Distributed::RemoteWorkerClient.new(
46
- DeepTest::Options.new(:sync_options => {:source => "/tmp"}),
47
- test_server = stub_everything(:spawn_worker_server => worker_server),
48
- failover_workers = mock
49
- )
50
-
51
- client.expects(:load).with("filelist")
52
- client.load_files ["filelist"]
53
- end
54
-
55
- test "start_all starts workers on worker server" do
56
- client = DeepTest::Distributed::RemoteWorkerClient.new(
57
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}),
58
- test_server = stub_everything,
59
- failover_workers = mock
60
- )
61
-
62
- test_server.expects(:spawn_worker_server).with(options).
63
- returns(worker_server = stub_everything)
64
-
65
- client.expects(:load)
66
- client.load_files ["filelist"]
67
-
68
- worker_server.expects(:start_all)
69
- client.start_all
70
- end
71
-
72
- test "stop_all stops workers on worker server that was spawned in load_files" do
73
- worker_server = stub_everything
74
- client = DeepTest::Distributed::RemoteWorkerClient.new(
75
- DeepTest::Options.new(:sync_options => {:source => "/tmp"}),
76
- test_server = stub_everything(:spawn_worker_server => worker_server),
77
- failover_workers = mock
78
- )
79
-
80
- client.expects(:load)
81
- client.load_files ["filelist"]
82
-
83
- worker_server.expects(:stop_all)
84
- client.stop_all
85
- end
86
-
87
- test "exception in start_all causes failover to failover_workers" do
88
- client = DeepTest::Distributed::RemoteWorkerClient.new(
89
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}, :ui => DeepTest::UI::Null),
90
- test_server = stub_everything,
91
- failover_workers = mock
92
- )
93
-
94
- test_server.expects(:spawn_worker_server).with(options).
95
- returns(worker_server = mock)
96
-
97
- worker_server.expects(:load_files)
98
- client.expects(:load)
99
- client.load_files ["filelist"]
100
-
101
- worker_server.expects(:start_all).raises("An Error")
102
-
103
- failover_workers.expects(:start_all)
104
- client.start_all
105
-
106
- failover_workers.expects(:stop_all)
107
- client.stop_all
108
- end
109
-
110
- test "exception in sync causes failover to failover_workers" do
111
- client = DeepTest::Distributed::RemoteWorkerClient.new(
112
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}, :ui => DeepTest::UI::Null),
113
- test_server = mock,
114
- failover_workers = mock
115
- )
116
-
117
- test_server.expects(:sync).raises("An Error")
118
-
119
- client.expects(:load)
120
- client.load_files ["filelist"]
121
-
122
- failover_workers.expects(:start_all)
123
- client.start_all
124
-
125
- failover_workers.expects(:stop_all)
126
- client.stop_all
127
- end
128
-
129
- test "exception in load_files causes failover to failover_workers" do
130
- client = DeepTest::Distributed::RemoteWorkerClient.new(
131
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}, :ui => DeepTest::UI::Null),
132
- test_server = stub_everything,
133
- failover_workers = mock
134
- )
135
-
136
- test_server.expects(:spawn_worker_server).with(options).
137
- returns(worker_server = Object.new)
138
-
139
- worker_server.instance_eval do
140
- def calls() @calls ||= []; end
141
- def method_missing(sym, *args) calls << sym; end
142
- def load_files(filelist) raise "An Error"; end
143
- end
144
-
145
- client.expects(:load)
146
- client.load_files ["filelist"]
147
-
148
- failover_workers.expects(:start_all)
149
- client.start_all
150
-
151
- failover_workers.expects(:stop_all)
152
- client.stop_all
153
-
154
- assert_equal [], worker_server.calls
155
- end
156
-
157
- test "exception from start_all of failover_workers is raised" do
158
- client = DeepTest::Distributed::RemoteWorkerClient.new(
159
- options = DeepTest::Options.new(:sync_options => {:source => "/tmp"}, :ui => DeepTest::UI::Null),
160
- test_server = stub_everything,
161
- failover_workers = mock
162
- )
163
-
164
- test_server.expects(:spawn_worker_server).with(options).
165
- returns(worker_server = mock)
166
-
167
- worker_server.expects(:load_files).raises("An Error")
168
- client.expects(:load)
169
- client.load_files ["filelist"]
170
-
171
- failover_workers.expects(:start_all).raises("Failover Error").then.returns(nil)
172
-
173
- begin
174
- client.start_all
175
- flunk
176
- rescue RuntimeError => e
177
- assert_equal "Failover Error", e.message
178
- end
179
- end
180
- end
@@ -1,99 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../test_helper"
2
-
3
- unit_tests do
4
- test "start_all delegates to worker implementation" do
5
- server = DeepTest::Distributed::RemoteWorkerServer.new("", implementation = mock)
6
- implementation.expects(:start_all)
7
- server.start_all
8
- end
9
-
10
- test "stop_all delegates to worker implementation" do
11
- server = DeepTest::Distributed::RemoteWorkerServer.new("", implementation = mock)
12
- implementation.expects(:stop_all)
13
- server.stop_all.join
14
- end
15
-
16
- test "stop_all returns without waiting for stops" do
17
- implementation = Object.new.instance_eval do
18
- def done?
19
- @done == true
20
- end
21
-
22
- def stop_all
23
- sleep 0.01
24
- @done = true
25
- end
26
- self
27
- end
28
-
29
- server = DeepTest::Distributed::RemoteWorkerServer.new("", implementation)
30
- server.stop_all
31
- assert_equal false, implementation.done?
32
-
33
- until implementation.done?
34
- sleep 0.01
35
- end
36
- end
37
-
38
- test "load_files loads each file in list, resolving each filename with resolver" do
39
- DeepTest::Distributed::FilenameResolver.expects(:new).with("/mirror/dir").
40
- returns(resolver = mock)
41
-
42
- server = DeepTest::Distributed::RemoteWorkerServer.new("/mirror/dir", stub_everything)
43
-
44
- resolver.expects(:resolve).with("/source/path/my/file.rb").
45
- returns("/mirror/dir/my/file.rb")
46
- server.expects(:load).with("/mirror/dir/my/file.rb")
47
- Dir.expects(:chdir).with("/mirror/dir")
48
-
49
- server.load_files(["/source/path/my/file.rb"])
50
- end
51
-
52
- test "service is removed after grace period if workers haven't been started" do
53
- log_level = DeepTest.logger.level
54
- begin
55
- DeepTest.logger.level = Logger::ERROR
56
- DeepTest::Distributed::RemoteWorkerServer.start(
57
- "localhost",
58
- "base_path",
59
- stub_everything,
60
- 0.25
61
- )
62
- # Have to sleep long enough to warlock to reap dead process
63
- sleep 1.0
64
- assert_equal 0, DeepTest::Distributed::RemoteWorkerServer.running_server_count
65
- ensure
66
- begin
67
- DeepTest::Distributed::RemoteWorkerServer.stop_all
68
- ensure
69
- DeepTest.logger.level = log_level
70
- end
71
- end
72
- end
73
-
74
- test "service is not removed after grace period if workers have been started" do
75
- log_level = DeepTest.logger.level
76
- begin
77
- DeepTest.logger.level = Logger::ERROR
78
- server = nil
79
- capture_stdout do
80
- server = DeepTest::Distributed::RemoteWorkerServer.start(
81
- Socket.gethostname,
82
- "",
83
- stub_everything,
84
- 0.25
85
- )
86
- end
87
- server.start_all
88
- # Have to sleep long enough to warlock to reap dead process
89
- sleep 1.0
90
- assert_equal 1, DeepTest::Distributed::RemoteWorkerServer.running_server_count
91
- ensure
92
- begin
93
- DeepTest::Distributed::RemoteWorkerServer.stop_all
94
- ensure
95
- DeepTest.logger.level = log_level
96
- end
97
- end
98
- end
99
- end
@@ -1,94 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../test_helper"
2
-
3
- unit_tests do
4
- test "generates a local working copy path based on host and source of request" do
5
- DeepTest::Distributed::DRbClientConnectionInfo.expects(:new).
6
- returns(:connection_info)
7
-
8
- Socket.stubs(:gethostname).returns("myhost", "serverhost")
9
- server = DeepTest::Distributed::TestServer.new(:work_dir => "/tmp")
10
- options = DeepTest::Options.new(:sync_options => {:source => "/my/local/dir"})
11
- DeepTest::Distributed::RSync.expects(:sync).with(:connection_info,
12
- options,
13
- "/tmp/myhost_my_local_dir")
14
- server.sync(options)
15
- end
16
-
17
- test "work_dir can be set from command line" do
18
- config = DeepTest::Distributed::TestServer.parse_args(
19
- ['--work_dir','path']
20
- )
21
- assert_equal 'path', config[:work_dir]
22
- end
23
-
24
- test "uri can be set from command line" do
25
- config = DeepTest::Distributed::TestServer.parse_args(['--uri','uri'])
26
- assert_equal 'uri', config[:uri]
27
- end
28
-
29
- test "number_of_workers can be set from command line" do
30
- config = DeepTest::Distributed::TestServer.parse_args(
31
- ['--number_of_workers','4']
32
- )
33
- assert_equal 4, config[:number_of_workers]
34
- end
35
-
36
- test "default number_of_workers is 2" do
37
- assert_equal(
38
- 2,
39
- DeepTest::Distributed::TestServer::DEFAULT_CONFIG[:number_of_workers]
40
- )
41
- end
42
-
43
- test "uses default options for those not specified" do
44
- config = DeepTest::Distributed::TestServer.parse_args([])
45
- assert_equal DeepTest::Distributed::TestServer::DEFAULT_CONFIG, config
46
- end
47
-
48
- test "spawn_worker_server starts RemoteWorkerServer with TestServerWorkers" do
49
- config = {:number_of_workers => 4, :uri => "druby://localhost:4022"}
50
- server = DeepTest::Distributed::TestServer.new(config)
51
- options = DeepTest::Options.new(:sync_options => {:source => ""})
52
- DeepTest::Distributed::DRbClientConnectionInfo.expects(:new).
53
- returns(:connection_info)
54
-
55
- DeepTest::Distributed::TestServerWorkers.expects(:new).with(
56
- options, config, :connection_info
57
- ).returns(:workers)
58
-
59
- DeepTest::Distributed::RemoteWorkerServer.expects(:start).with(
60
- "localhost", anything, :workers
61
- )
62
-
63
- server.spawn_worker_server(options)
64
- end
65
-
66
- test "connect creates dispatch controller for all servers" do
67
- options = DeepTest::Options.new({:ui => "DeepTest::UI::Null"})
68
- DRbObject.expects(:new_with_uri).returns(server = mock)
69
- server.expects(:servers).returns([s1 = mock, s2 = mock])
70
- s1.expects(:sync)
71
- s2.expects(:sync)
72
- DeepTest::Distributed::TestServer.connect(options).sync(options)
73
- end
74
-
75
- test "status.binding_uri is the uri that DRb is bound to" do
76
- server = DeepTest::Distributed::TestServer.new(:number_of_workers => 4)
77
- DRb.expects(:uri).returns("druby://test")
78
- assert_equal "druby://test", server.status.binding_uri
79
- end
80
-
81
- test "status.number_of_workers in the configured number of workers" do
82
- server = DeepTest::Distributed::TestServer.new(:number_of_workers => 4)
83
- DRb.expects(:uri)
84
- assert_equal 4, server.status.number_of_workers
85
- end
86
-
87
- test "status.remote_worker_server_count is number of servers currently running" do
88
- server = DeepTest::Distributed::TestServer.new(:number_of_workers => 4)
89
- DRb.expects(:uri)
90
- DeepTest::Distributed::RemoteWorkerServer.expects(:running_server_count).
91
- returns(3)
92
- assert_equal 3, server.status.remote_worker_server_count
93
- end
94
- end
@@ -1,26 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../test_helper"
2
-
3
- unit_tests do
4
- test "number_of_workers is determined by mirror server options" do
5
- workers = DeepTest::Distributed::TestServerWorkers.new(
6
- DeepTest::Options.new({}),
7
- {:number_of_workers => 4},
8
- mock
9
- )
10
-
11
- assert_equal 4, workers.number_of_workers
12
- end
13
-
14
- test "server is retrieved using client connection information" do
15
- workers = DeepTest::Distributed::TestServerWorkers.new(
16
- options = DeepTest::Options.new({}),
17
- {:number_of_workers => 4},
18
- mock(:address => "address")
19
- )
20
- DeepTest::Server.expects(:remote_reference).
21
- with("address", options.server_port).
22
- returns(:server_reference)
23
-
24
- assert_equal :server_reference, workers.server
25
- end
26
- end
@@ -1,68 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../test_helper"
2
-
3
- unit_tests do
4
- test "runner adds specified number of work units to blackboard" do
5
- blackboard = DeepTest::SimpleTestBlackboard.new
6
- runner = DeepTest::Distributed::ThroughputRunner.new(
7
- DeepTest::Options.new({}),
8
- 5,
9
- blackboard
10
- )
11
-
12
- worker = ThreadWorker.new(blackboard, 5)
13
- Timeout.timeout(5) do
14
- runner.process_work_units
15
- end
16
- worker.wait_until_done
17
- end
18
-
19
- test "runner yields all results from blackboard" do
20
- blackboard = DeepTest::SimpleTestBlackboard.new
21
- count = 0
22
- runner = DeepTest::Distributed::ThroughputRunner.new(
23
- DeepTest::Options.new({}),
24
- 2,
25
- blackboard
26
- ) do |result|
27
- assert_equal :null_work_unit_result, result
28
- count += 1
29
- end
30
-
31
- worker = ThreadWorker.new(blackboard, 2)
32
- Timeout.timeout(5) do
33
- runner.process_work_units
34
- end
35
- worker.wait_until_done
36
-
37
- assert_equal 2, count
38
- end
39
-
40
- test "statistics are available after run" do
41
- blackboard = DeepTest::SimpleTestBlackboard.new
42
- runner = DeepTest::Distributed::ThroughputRunner.new(
43
- DeepTest::Options.new({}),
44
- 2,
45
- blackboard
46
- )
47
-
48
- worker = ThreadWorker.new(blackboard, 2)
49
- count = 0
50
- Timeout.timeout(5) do
51
- runner.process_work_units
52
- end
53
- worker.wait_until_done
54
-
55
- assert_kind_of DeepTest::Distributed::ThroughputStatistics,
56
- runner.statistics
57
- end
58
-
59
- test "runner returns true" do
60
- runner = DeepTest::Distributed::ThroughputRunner.new(
61
- DeepTest::Options.new({}),
62
- 0,
63
- DeepTest::SimpleTestBlackboard.new
64
- )
65
-
66
- assert_equal true, runner.process_work_units
67
- end
68
- end