jstorimer-deep-test 0.2.0 → 1.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 +0 -1
  2. data/README.rdoc +70 -41
  3. data/Rakefile +104 -32
  4. data/TODO +2 -2
  5. data/VERSION +1 -1
  6. data/bin/deep_test +15 -0
  7. data/jstorimer-deep-test-0.1.0.gem +0 -0
  8. data/jstorimer-deep-test.gemspec +1425 -0
  9. data/lib/deep_test.rb +40 -28
  10. data/lib/deep_test/database/mysql_setup_listener.rb +12 -12
  11. data/lib/deep_test/database/setup_listener.rb +23 -23
  12. data/lib/deep_test/distributed/dispatch_controller.rb +10 -17
  13. data/lib/deep_test/distributed/drb_client_connection_info.rb +15 -0
  14. data/lib/deep_test/distributed/master_test_server.rb +52 -0
  15. data/lib/deep_test/distributed/multi_test_server_proxy.rb +44 -0
  16. data/lib/deep_test/distributed/null_work_unit.rb +12 -0
  17. data/lib/deep_test/distributed/remote_worker_client.rb +54 -0
  18. data/lib/deep_test/distributed/remote_worker_server.rb +82 -0
  19. data/lib/deep_test/distributed/rsync.rb +12 -25
  20. data/lib/deep_test/distributed/show_status.rhtml +41 -0
  21. data/lib/deep_test/distributed/test_server.rb +78 -0
  22. data/lib/deep_test/distributed/test_server_status.rb +9 -0
  23. data/lib/deep_test/distributed/test_server_workers.rb +24 -0
  24. data/lib/deep_test/distributed/throughput_runner.rb +42 -0
  25. data/lib/deep_test/distributed/throughput_statistics.rb +26 -0
  26. data/lib/deep_test/distributed/throughput_worker_client.rb +19 -0
  27. data/lib/deep_test/extensions/drb_extension.rb +34 -0
  28. data/lib/deep_test/listener_list.rb +1 -1
  29. data/lib/deep_test/local_workers.rb +55 -0
  30. data/lib/deep_test/logger.rb +2 -17
  31. data/lib/deep_test/marshallable_exception_wrapper.rb +4 -4
  32. data/lib/deep_test/metrics/gatherer.rb +67 -0
  33. data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +133 -0
  34. data/lib/deep_test/{null_listener.rb → null_worker_listener.rb} +14 -14
  35. data/lib/deep_test/option.rb +60 -0
  36. data/lib/deep_test/options.rb +42 -45
  37. data/lib/deep_test/process_orchestrator.rb +49 -0
  38. data/lib/deep_test/rake_tasks.rb +1 -3
  39. data/lib/deep_test/result_reader.rb +6 -10
  40. data/lib/deep_test/rspec_detector.rb +1 -1
  41. data/lib/deep_test/server.rb +75 -0
  42. data/lib/deep_test/spec.rb +1 -5
  43. data/lib/deep_test/spec/extensions/example_methods.rb +1 -7
  44. data/lib/deep_test/spec/extensions/reporter.rb +29 -0
  45. data/lib/deep_test/spec/extensions/spec_task.rb +2 -3
  46. data/lib/deep_test/spec/runner.rb +17 -32
  47. data/lib/deep_test/spec/work_result.rb +0 -2
  48. data/lib/deep_test/test/runner.rb +2 -2
  49. data/lib/deep_test/test/supervised_test_suite.rb +10 -9
  50. data/lib/deep_test/test/work_result.rb +0 -1
  51. data/lib/deep_test/test_task.rb +1 -1
  52. data/lib/deep_test/ui/console.rb +11 -9
  53. data/lib/deep_test/warlock.rb +25 -37
  54. data/lib/deep_test/worker.rb +57 -0
  55. data/sample_rails_project/deep_test.rb +0 -4
  56. data/sample_rails_project/lib/{foreign_host_agent_simulation_listener.rb → foreign_host_worker_simulation_listener.rb} +4 -6
  57. data/sample_rails_project/lib/tasks/deep_test.rake +4 -13
  58. data/script/internal/run_test_suite.rb +7 -0
  59. data/script/public/master_test_server.rb +24 -0
  60. data/script/public/test_server.rb +18 -0
  61. data/script/public/test_throughput.rb +29 -0
  62. data/spec/deep_test/option_spec.rb +33 -0
  63. data/spec/deep_test/options_spec.rb +59 -80
  64. data/spec/deep_test/spec/extensions/example_methods_spec.rb +4 -5
  65. data/spec/deep_test/spec/extensions/spec_task_spec.rb +6 -4
  66. data/spec/deep_test/spec/runner_spec.rb +32 -59
  67. data/spec/spec_helper.rb +6 -14
  68. data/spec/thread_worker.rb +25 -0
  69. data/test/deep_test/database/mysql_setup_listener_test.rb +9 -13
  70. data/test/deep_test/distributed/dispatch_controller_test.rb +177 -130
  71. data/test/deep_test/distributed/drb_client_connection_info_test.rb +42 -0
  72. data/test/deep_test/distributed/filename_resolver_test.rb +34 -38
  73. data/test/deep_test/distributed/master_test_server_test.rb +32 -0
  74. data/test/deep_test/distributed/multi_test_server_proxy_test.rb +96 -0
  75. data/test/deep_test/distributed/remote_worker_client_test.rb +180 -0
  76. data/test/deep_test/distributed/remote_worker_server_test.rb +99 -0
  77. data/test/deep_test/distributed/rsync_test.rb +62 -42
  78. data/test/deep_test/distributed/test_server_test.rb +94 -0
  79. data/test/deep_test/distributed/test_server_workers_test.rb +26 -0
  80. data/test/deep_test/distributed/throughput_runner_test.rb +68 -0
  81. data/test/deep_test/distributed/throughput_worker_client_test.rb +28 -0
  82. data/test/deep_test/listener_list_test.rb +15 -17
  83. data/test/deep_test/local_workers_test.rb +22 -0
  84. data/test/deep_test/logger_test.rb +7 -34
  85. data/test/deep_test/marshallable_exception_wrapper_test.rb +29 -31
  86. data/test/deep_test/metrics/gatherer_test.rb +66 -0
  87. data/test/deep_test/process_orchestrator_test.rb +11 -0
  88. data/test/deep_test/result_reader_test.rb +95 -95
  89. data/test/deep_test/server_test.rb +58 -0
  90. data/test/deep_test/test/extensions/error_test.rb +36 -38
  91. data/test/deep_test/test/runner_test.rb +3 -7
  92. data/test/deep_test/test/supervised_test_suite_test.rb +61 -89
  93. data/test/deep_test/test/work_result_test.rb +76 -80
  94. data/test/deep_test/test/work_unit_test.rb +51 -53
  95. data/test/deep_test/test_task_test.rb +38 -10
  96. data/test/deep_test/ui/console_test.rb +4 -8
  97. data/test/deep_test/warlock_test.rb +31 -33
  98. data/test/deep_test/worker_test.rb +94 -0
  99. data/test/failing.rake +11 -0
  100. data/{negative_acceptance_tests/failing_test.rb → test/failing.rb} +1 -3
  101. data/{infrastructure → test}/fake_deadlock_error.rb +0 -0
  102. data/test/simple_test_blackboard.rb +45 -0
  103. data/test/simple_test_blackboard_test.rb +33 -0
  104. data/{infrastructure → test}/test_factory.rb +0 -0
  105. data/test/test_helper.rb +5 -20
  106. data/test/test_task_test.rb +57 -60
  107. metadata +78 -87
  108. data/infrastructure/dynamic_teardown.rb +0 -22
  109. data/infrastructure/load.rb +0 -11
  110. data/infrastructure/test_central_command.rb +0 -15
  111. data/infrastructure/test_exception.rb +0 -7
  112. data/infrastructure/test_logger.rb +0 -11
  113. data/infrastructure/test_operator.rb +0 -15
  114. data/infrastructure/test_result.rb +0 -15
  115. data/infrastructure/thread_agent.rb +0 -21
  116. data/infrastructure/timewarp/Rakefile +0 -14
  117. data/infrastructure/timewarp/lib/timewarp.rb +0 -21
  118. data/infrastructure/timewarp/test/timewarp_test.rb +0 -45
  119. data/lib/deep_test/agent.rb +0 -108
  120. data/lib/deep_test/central_command.rb +0 -165
  121. data/lib/deep_test/cpu_info.rb +0 -22
  122. data/lib/deep_test/demon.rb +0 -25
  123. data/lib/deep_test/distributed/beachhead.rb +0 -104
  124. data/lib/deep_test/distributed/establish_beachhead.rb +0 -19
  125. data/lib/deep_test/distributed/landing_fleet.rb +0 -30
  126. data/lib/deep_test/distributed/landing_ship.rb +0 -60
  127. data/lib/deep_test/distributed/remote_deployment.rb +0 -56
  128. data/lib/deep_test/distributed/shell_environment.rb +0 -50
  129. data/lib/deep_test/distributed/ssh_client_connection_info.rb +0 -14
  130. data/lib/deep_test/failure_message.rb +0 -19
  131. data/lib/deep_test/lib_root.rb +0 -4
  132. data/lib/deep_test/local_deployment.rb +0 -46
  133. data/lib/deep_test/main.rb +0 -41
  134. data/lib/deep_test/metrics/data.rb +0 -34
  135. data/lib/deep_test/metrics/measurement.rb +0 -39
  136. data/lib/deep_test/proxy_io.rb +0 -77
  137. data/lib/deep_test/test/run_test_suite.rb +0 -5
  138. data/lib/telegraph.rb +0 -29
  139. data/lib/telegraph/ack_sequence.rb +0 -14
  140. data/lib/telegraph/logging.rb +0 -20
  141. data/lib/telegraph/message.rb +0 -39
  142. data/lib/telegraph/operator.rb +0 -47
  143. data/lib/telegraph/switchboard.rb +0 -57
  144. data/lib/telegraph/wire.rb +0 -73
  145. data/negative_acceptance_tests/dying_spec.rb +0 -13
  146. data/negative_acceptance_tests/dying_test.rb +0 -13
  147. data/negative_acceptance_tests/failing_spec.rb +0 -9
  148. data/negative_acceptance_tests/kill_agent_one_on_start_work.rb +0 -16
  149. data/negative_acceptance_tests/passing_spec.rb +0 -10
  150. data/negative_acceptance_tests/passing_test.rb +0 -12
  151. data/negative_acceptance_tests/tasks.rake +0 -87
  152. data/negative_acceptance_tests/tests.rb +0 -60
  153. data/test/deep_test/agent_test.rb +0 -175
  154. data/test/deep_test/central_command_test.rb +0 -147
  155. data/test/deep_test/cpu_info_test.rb +0 -33
  156. data/test/deep_test/demon_test.rb +0 -23
  157. data/test/deep_test/distributed/beachhead_test.rb +0 -67
  158. data/test/deep_test/distributed/landing_fleet_test.rb +0 -55
  159. data/test/deep_test/distributed/landing_ship_test.rb +0 -48
  160. data/test/deep_test/distributed/remote_deployment_test.rb +0 -134
  161. data/test/deep_test/distributed/shell_environment_fixtures/set_bar_to_foo +0 -1
  162. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_bar +0 -1
  163. data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_baz +0 -1
  164. data/test/deep_test/distributed/shell_environment_test.rb +0 -108
  165. data/test/deep_test/distributed/ssh_client_connection_info_test.rb +0 -34
  166. data/test/deep_test/local_deployment_test.rb +0 -19
  167. data/test/deep_test/main_test.rb +0 -12
  168. data/test/deep_test/metrics/data_test.rb +0 -22
  169. data/test/deep_test/metrics/measurement_test.rb +0 -18
  170. data/test/deep_test/proxy_io_test.rb +0 -104
data/.gitignore CHANGED
@@ -2,5 +2,4 @@ deep_test.metrics
2
2
  doc
3
3
  pkg
4
4
  tags
5
- negative_acceptance_tests/metrics.data
6
5
 
data/README.rdoc CHANGED
@@ -5,12 +5,6 @@ may spawned locally to take advantage of multiple processors on a single
5
5
  machine or distributed across many machines to take advantage of distributed
6
6
  processing.
7
7
 
8
- == Note
9
-
10
- This README has been updated to reflect changes made on the master branch that have
11
- not yet been released. If you are looking for the README for DeepTest 1.2 it is
12
- availeble on the 1.2.x branch on github.
13
-
14
8
  == Usage
15
9
 
16
10
  In your Rakefile:
@@ -21,7 +15,9 @@ In your Rakefile:
21
15
  # sample DeepTest task
22
16
 
23
17
  DeepTest::TestTask.new "task_name" do |t|
24
- t.number_of_agents = 2 # optional, defaults to number of cores
18
+ t.number_of_workers = 2 # optional, defaults to 2
19
+ t.timeout_in_seconds = 30 # optional, defaults to 30
20
+ t.server_port = 6969 # optional, defaults to 6969
25
21
  t.pattern = "test/**/*_test.rb"
26
22
  t.libs << "test" # may be necessary for Rails >= 2.1.x
27
23
  end
@@ -30,27 +26,29 @@ In your Rakefile:
30
26
 
31
27
  Spec::Rake::SpecTask.new(:deep_spec) do |t|
32
28
  t.spec_files = FileList['spec/**/*_spec.rb']
33
- t.deep_test :number_of_agents => 2 # optional, defaults to number of cores
29
+ t.deep_test :number_of_workers => 2, # optional, defaults to 2
30
+ :timeout_in_seconds => 30, # optional, defaults to 30
31
+ :server_port => 6969 # optional, defaults to 6969
34
32
  end
35
33
 
36
34
 
37
35
  === Specifying a Listener to be Notified of Events
38
36
 
39
- In my_listener.rb
40
- class MyListener
37
+ In my_worker_listener.rb
38
+ class MyWorkerListener
41
39
  def before_sync
42
40
  end
43
41
 
44
- def before_starting_agents
42
+ def before_starting_workers
45
43
  end
46
44
 
47
- def starting(agent)
45
+ def starting(worker)
48
46
  end
49
47
 
50
- def starting_work(agent, work_unit)
48
+ def starting_work(worker, work_unit)
51
49
  end
52
50
 
53
- def finished_work(agent, work_unit, result)
51
+ def finished_work(worker, work_unit, result)
54
52
  end
55
53
  end
56
54
 
@@ -58,37 +56,37 @@ In your Rakefile
58
56
 
59
57
  DeepTest::TestTask.new "task_name" do |t|
60
58
  ...
61
- t.listener = "MyListener"
59
+ t.worker_listener = "MyWorkerListener"
62
60
  end
63
61
 
64
- An instance of MyListener will be created for each agent that is
65
- started, and will receive events from that agent. However, you must ensure
66
- that the MyListener class is loaded at the time that the test files are
62
+ An instance of MyWorkerListener will be created for each worker that is
63
+ started, and will receive events from that worker. However, you must ensure
64
+ that the MyWorkerListener class is loaded at the time that the test files are
67
65
  loaded, so it is available to be instantiated. You can specify multiple
68
66
  listener classes by separating them with a comma. For more information about
69
67
  when events are triggered, see the documentation at
70
- DeepTest::NullListener.
68
+ DeepTest::NullWorkerListener.
71
69
 
72
70
 
73
- === Setting Up A New Database For Each Agent
71
+ === Setting Up A New Database For Each Worker
74
72
 
75
73
  By default, DeepTest will reinitialize ActiveRecord connections if ActiveRecord
76
- is loaded when the agents are started. This means all agents are running
77
- against the same database. You may want each agent to use a database
78
- decidicated to it. To facilitate this, DeepTest provides a agent listener to
74
+ is loaded when the workers are started. This means all workers are running
75
+ against the same database. You may want each worker to use a database
76
+ decidicated to it. To facilitate this, DeepTest provides a worker listener to
79
77
  help you. If you're using Rails with Mysql, simply configure DeepTest as
80
78
  follows in your Rakefile:
81
79
 
82
80
  DeepTest::TestTask.new "task_name" do |t|
83
81
  ...
84
- t.listener = "DeepTest::Database::MysqlSetupListener"
82
+ t.worker_listener = "DeepTest::Database::MysqlSetupListener"
85
83
  end
86
84
 
87
85
 
88
- Before spawning agents, DeepTest will dump the schema of the database for the
89
- current Rails environment (usually test). As each agent starts up, the
90
- listener will create a database dedicated to that agent and load the schema
91
- into it. The database will be dropped when the agent process exits.
86
+ Before spawning workers, DeepTest will dump the schema of the database for the
87
+ current Rails environment (usually test). As each worker starts up, the
88
+ listener will create a database dedicated to that worker and load the schema
89
+ into it. The database will be dropped when the worker process exits.
92
90
 
93
91
  If you're using Mysql but not using Rails, you'll have to create a subclass of
94
92
  MysqlSetupListener and override +master_database_config+ and +dump_file_name+,
@@ -105,7 +103,7 @@ project so that it can be included in later releases of DeepTest.
105
103
  In addition to running your tests in parallel, DeepTest can also distribute
106
104
  them across multiple machines. It does this by first mirroring the local
107
105
  working copy that launched the tests on each machine that will be running tests.
108
- Then agents are launched on each of the machines and consume tests in the same
106
+ Then workers are launched on each of the machines and consume tests in the same
109
107
  fashion as when DeepTest is running locally.
110
108
 
111
109
  ==== Requirements
@@ -122,23 +120,55 @@ local development machine. DeepTest must also be installed as a gem on each
122
120
  test machine and available either as a gem or in your project on the local
123
121
  machine.
124
122
 
125
- ==== Configuring Your Project
123
+ ==== Starting a Test Server
124
+
125
+ On each test machine, execute the following:
126
+ > deep_test test_server
127
+
128
+ This will launch a server providing mirroring and worker services. By default,
129
+ 2 workers will be launched for each set of tests run. If you wish to change
130
+ the number of workers, simply specify the --number_of_workers option. For
131
+ information about what options are available, use -h. The test_server will
132
+ print out the uri it is bound to, druby://<hostname>:4022 by default.
133
+
134
+ ==== Starting a Master Test Server
135
+
136
+ On a single machine (probably one of the test machines), execute this:
137
+ > deep_test master_test_server <uris of test servers>
126
138
 
127
- There is no need to start a special daemon process on the machines that will
128
- be used to run DeepTest. Simply specify the names of the hosts that you
129
- would like DeepTest to distribute to along with a set of sync_options telling
130
- it how to to rsync the project code.
139
+ The master_test_server will also print it's binding uri,
140
+ druby://<hostname>:4021 by default. It will also provide a webserver bound
141
+ to port 4020 that provides a status page summarizing the state of all the
142
+ test servers.
143
+
144
+ ==== Overriding the DRb uri for the Test Server or Master Test Server
145
+
146
+ The DRb url that the Test Server or Master Test Server should bind to can be
147
+ specified when the process is started. Use the --uri option followed by the
148
+ DRb url that you would like DRb to bind to and return to clients. By default,
149
+ DRb does not provide any capability to bind to all addresses but return a
150
+ specific IP or hostname as part of the DRb url for clients. DeepTest provides
151
+ a special DRb protocol to enable this, drubyall. If you wish your test server
152
+ to listen on all addresses (which you probably do), start the server
153
+ with a command like this (where deeptest1.local is the hostname of the machine):
154
+ > deep_test test_server --uri drubyall://deeptest1.local/
155
+
156
+ The server will report that it is listening on druby://deeptest1.local as the
157
+ public DRb url, but it will actually accept connections on all addresses to
158
+ server requests.
159
+
160
+
161
+ ==== Configuring Your Project
131
162
 
132
163
  If you're using rsync over ssh, create a DeepTest test task similar to that
133
164
  below in your Rakefile.
134
165
 
135
166
  DeepTest::TestTask.new "deep_test_distributed" do |t|
136
167
  t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
137
- t.distributed_hosts = %w[host1 host2]
168
+ t.distributed_server = <drb uri of master_test_server>
138
169
  t.sync_options = {
139
170
  :source => <absolute path of project root on machine>,
140
- :username => "username",
141
- :remote_base_dir => <absolute path to keep working copies in on remote machine> # defaults to /tmp
171
+ :username => "username"
142
172
  }
143
173
  end
144
174
 
@@ -151,7 +181,7 @@ rake task as follows.
151
181
 
152
182
  DeepTest::TestTask.new "deep_test_distributed" do |t|
153
183
  t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
154
- t.distributed_hosts = %w[host1 host2]
184
+ t.distributed_server = <drb uri of master_test_server>
155
185
  t.sync_options = {
156
186
  :source => <name of rsync module from daemon configuration>,
157
187
  :daemon => true,
@@ -159,6 +189,7 @@ rake task as follows.
159
189
  }
160
190
  end
161
191
 
192
+
162
193
  Username is optional in both cases. You'll need to either setup passwordless
163
194
  ssh access or run an rsync daemon that doesn't require passwords.
164
195
 
@@ -179,7 +210,7 @@ least have something like this:
179
210
  That way you can avoid spending any time mirroring tmp and log files that don't
180
211
  have any effect on the tests. If you are running distributed tests against a
181
212
  database, consult the section above about creating a new database for each
182
- agent to see how to configure DeepTest for your project.
213
+ worker to see how to configure DeepTest for your project.
183
214
 
184
215
  Any number of projects can be run using the same test servers, as long as
185
216
  they're all using the same version of Ruby and DeepTest.
@@ -190,8 +221,6 @@ they're all using the same version of Ruby and DeepTest.
190
221
  * Alex Chaffee
191
222
  * Dan[http://www.dcmanges.com/blog] Manges[http://www.dcmanges.com/blog]
192
223
  * David[http://davidvollbracht.com/] Vollbracht[http://davidvollbracht.com/]
193
- * Brian[http://blog.brianguthrie.com/] Guthrie[http://blog.brianguthrie.com/]
194
- * Shane[http://shanel.tumblr.com/] Liebling[http://shanel.tumblr.com/]
195
224
  * Scott Taylor
196
225
 
197
226
  == License
data/Rakefile CHANGED
@@ -6,22 +6,21 @@ require 'rake/contrib/sshpublisher'
6
6
  require 'yaml'
7
7
 
8
8
  require 'rubygems'
9
- gem('rspec', ENV['RSPEC_VERSION'] || '1.1.12')
9
+ gem 'rspec', '=1.1.8'
10
10
  require 'spec/rake/spectask'
11
11
 
12
12
  $LOAD_PATH << File.dirname(__FILE__) + "/lib"
13
-
14
13
  require "deep_test/rake_tasks"
15
14
 
16
15
  task :default => %w[
17
16
  test
18
17
  spec
18
+ failing_test
19
19
  deep_test
20
- deep_spec_1.1.8
21
- deep_spec_1.1.12
22
- distributed_test
23
- distributed_spec
24
- negative_acceptance_tests
20
+ deep_spec
21
+ run_distributed
22
+ run_distributed_with_worker_down
23
+ run_distributed_with_failover
25
24
  test_rails_project
26
25
  ]
27
26
 
@@ -33,23 +32,18 @@ Rake::TestTask.new do |t|
33
32
  end
34
33
 
35
34
  DeepTest::TestTask.new :deep_test do |t|
35
+ t.number_of_workers = 2
36
36
  t.pattern = "test/**/*_test.rb"
37
- end
38
-
39
- DeepTest::TestTask.new(:manual_distributed_test) do |t|
40
- t.pattern = "test/**/*_test.rb"
41
- t.distributed_hosts = (ENV['HOSTS'] || '').split(' ')
42
- t.sync_options = {:source => File.dirname(__FILE__),
43
- :username => ENV['USERNAME'],
44
- :rsync_options => "--exclude=.svn"}
37
+ t.metrics_file = "deep_test.metrics"
45
38
  end
46
39
 
47
40
  DeepTest::TestTask.new(:distributed_test) do |t|
41
+ t.number_of_workers = 2
48
42
  t.pattern = "test/**/*_test.rb"
49
- t.distributed_hosts = %w[localhost]
43
+ t.distributed_server = "druby://localhost:8000"
50
44
  t.sync_options = {:source => File.dirname(__FILE__),
51
- :rsync_options => "--exclude=.svn",
52
- :remote_base_dir => "/tmp/deep_test"}
45
+ :local => true,
46
+ :rsync_options => "--exclude=.svn"}
53
47
  end
54
48
 
55
49
  Spec::Rake::SpecTask.new(:spec) do |t|
@@ -58,26 +52,103 @@ end
58
52
 
59
53
  Spec::Rake::SpecTask.new(:deep_spec) do |t|
60
54
  t.spec_files = FileList['spec/**/*_spec.rb']
61
- t.deep_test({})
62
- end
63
-
64
- task :'deep_spec_1.1.8' do
65
- sh 'rake deep_spec RSPEC_VERSION=1.1.8'
66
- end
67
-
68
- task :'deep_spec_1.1.12' do
69
- sh 'rake deep_spec RSPEC_VERSION=1.1.12'
55
+ t.deep_test :number_of_workers => 2
70
56
  end
71
57
 
72
58
  Spec::Rake::SpecTask.new(:distributed_spec) do |t|
73
59
  t.spec_files = FileList['spec/**/*_spec.rb']
74
- t.deep_test :distributed_hosts => %w[localhost],
60
+ t.deep_test :number_of_workers => 2,
61
+ :distributed_server => "druby://localhost:8000",
75
62
  :sync_options => {:source => File.dirname(__FILE__),
63
+ :local => true,
76
64
  :rsync_options => "--exclude=.svn"}
77
65
  end
78
66
 
79
- Rake::TestTask.new(:negative_acceptance_tests) do |t|
80
- t.pattern = "negative_acceptance_tests/tests.rb"
67
+ DeepTest::TestTask.new(:distribute_tests_to_minis) do |t|
68
+ t.number_of_workers = 2
69
+ t.pattern = "test/**/*_test.rb"
70
+ t.distributed_server = "druby://alpha.local:8000"
71
+ t.sync_options = {:source => File.dirname(__FILE__),
72
+ :username => "tworker",
73
+ :password => "thought",
74
+ :rsync_options => "--exclude=.svn"}
75
+ end
76
+
77
+ task :run_distributed do |t|
78
+ begin
79
+ FileUtils.mkdir('/tmp/test_1') unless File.exist?('/tmp/test_1')
80
+ FileUtils.mkdir('/tmp/test_2') unless File.exist?('/tmp/test_2')
81
+
82
+ test_1_pid = fork do
83
+ exec "ruby bin/deep_test test_server --uri drubyall://localhost:8001 --work_dir /tmp/test_1"
84
+ end
85
+
86
+ test_2_pid = fork do
87
+ exec "ruby bin/deep_test test_server --uri drubyall://localhost:8002 --work_dir /tmp/test_2"
88
+ end
89
+
90
+ master_pid = fork do
91
+ exec "ruby bin/deep_test master_test_server --uri drubyall://localhost:8000 druby://localhost:8001 druby://localhost:8002"
92
+ end
93
+
94
+ sleep 1
95
+
96
+ Rake::Task[:distributed_test].invoke
97
+ Rake::Task[:distributed_spec].invoke
98
+
99
+ sh "ruby bin/deep_test test_throughput druby://localhost:8000 20"
100
+ ensure
101
+ Process.kill('TERM', master_pid) if master_pid rescue nil
102
+ Process.kill('TERM', test_1_pid) if test_1_pid rescue nil
103
+ Process.kill('TERM', test_2_pid) if test_2_pid rescue nil
104
+ Process.waitall
105
+ end
106
+
107
+ sleep 1
108
+ end
109
+
110
+ task :run_distributed_with_worker_down do |t|
111
+ begin
112
+ FileUtils.mkdir('/tmp/test_1') unless File.exist?('/tmp/test_1')
113
+
114
+ test_1_pid = fork do
115
+ exec "ruby bin/deep_test test_server --uri drubyall://localhost:8001 --work_dir /tmp/test_1"
116
+ end
117
+
118
+ # don't start worker 2
119
+
120
+ master_pid = fork do
121
+ exec "ruby bin/deep_test master_test_server --uri drubyall://localhost:8000 druby://localhost:8001 druby://localhost:8002"
122
+ end
123
+
124
+ sleep 1
125
+
126
+ # Use throughput to make sure we can run tests
127
+ sh "ruby bin/deep_test test_throughput druby://localhost:8000 20"
128
+ ensure
129
+ Process.kill('TERM', master_pid) if master_pid rescue nil
130
+ Process.kill('TERM', test_1_pid) if test_1_pid rescue nil
131
+ Process.waitall
132
+ end
133
+ end
134
+
135
+ task :run_distributed_with_failover do |t|
136
+ puts
137
+ puts "*** Running distributed with no server - expect a failover message ***"
138
+ puts
139
+ Rake::Task[:distributed_spec].execute "dummy arg"
140
+ end
141
+
142
+ task :failing_test do
143
+ command = "rake --rakefile test/failing.rake 2>&1"
144
+ puts command
145
+ `#{command}`
146
+ if $?.success?
147
+ puts "F"
148
+ fail "****\ntest/failing.rake should have failed\n****"
149
+ else
150
+ puts "."
151
+ end
81
152
  end
82
153
 
83
154
  Rake::TestTask.new(:test_rails_project) do |t|
@@ -92,7 +163,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
92
163
  rdoc.rdoc_files.include(
93
164
  'README.rdoc',
94
165
  'CHANGELOG',
95
- 'lib/deep_test/null_listener.rb',
166
+ 'lib/deep_test/null_worker_listener.rb',
96
167
  'lib/deep_test/database/*.rb'
97
168
  )
98
169
  end
@@ -115,12 +186,13 @@ specification = Gem::Specification.new do |s|
115
186
  s.email = "daniel.manges@gmail.com"
116
187
  s.homepage = "http://deep-test.rubyforge.org"
117
188
  s.rubyforge_project = "deep-test"
189
+ s.executables << "deep_test"
118
190
 
119
191
  s.has_rdoc = true
120
192
  s.extra_rdoc_files = ['README.rdoc', 'CHANGELOG']
121
193
  s.rdoc_options << '--title' << "DeepTest" << '--main' << 'README.rdoc' << '--line-numbers'
122
194
 
123
- s.files = FileList['{lib,test}/**/*.{rb,rake}', 'README.rdoc', 'CHANGELOG', 'Rakefile'].to_a
195
+ s.files = FileList['{lib,script,test,bin}/**/*.{rb,rake,rhtml}', 'README.rdoc', 'CHANGELOG', 'Rakefile'].to_a
124
196
  end
125
197
 
126
198
  Rake::GemPackageTask.new(specification) do |package|
data/TODO CHANGED
@@ -1,4 +1,4 @@
1
- * Graceful handling if agents fail to start.
1
+ * Graceful handling if workers fail to start.
2
2
  * test loader
3
- * Log central_command write error
3
+ * Log blackboard write error
4
4
  * Handle not getting all results make more gracefully
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 1.0.0
data/bin/deep_test ADDED
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ script_dir = File.dirname(__FILE__) + '/../script/public'
4
+ script_file = script_dir + "/#{ARGV.shift}.rb"
5
+
6
+ unless File.exist?(script_file)
7
+ puts 'Usage: deep_test <script> [arguments]'
8
+ puts ' Available Scripts: '
9
+ Dir.glob(script_dir + '/*.rb').each do |name|
10
+ puts " #{File.basename(name, '.rb')}"
11
+ end
12
+ exit(1)
13
+ end
14
+
15
+ load script_file