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
data/.gitignore CHANGED
@@ -2,4 +2,5 @@ deep_test.metrics
2
2
  doc
3
3
  pkg
4
4
  tags
5
+ negative_acceptance_tests/metrics.data
5
6
 
data/README.rdoc CHANGED
@@ -5,6 +5,12 @@ 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
+
8
14
  == Usage
9
15
 
10
16
  In your Rakefile:
@@ -15,9 +21,7 @@ In your Rakefile:
15
21
  # sample DeepTest task
16
22
 
17
23
  DeepTest::TestTask.new "task_name" do |t|
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
24
+ t.number_of_agents = 2 # optional, defaults to number of cores
21
25
  t.pattern = "test/**/*_test.rb"
22
26
  t.libs << "test" # may be necessary for Rails >= 2.1.x
23
27
  end
@@ -26,29 +30,27 @@ In your Rakefile:
26
30
 
27
31
  Spec::Rake::SpecTask.new(:deep_spec) do |t|
28
32
  t.spec_files = FileList['spec/**/*_spec.rb']
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
33
+ t.deep_test :number_of_agents => 2 # optional, defaults to number of cores
32
34
  end
33
35
 
34
36
 
35
37
  === Specifying a Listener to be Notified of Events
36
38
 
37
- In my_worker_listener.rb
38
- class MyWorkerListener
39
+ In my_listener.rb
40
+ class MyListener
39
41
  def before_sync
40
42
  end
41
43
 
42
- def before_starting_workers
44
+ def before_starting_agents
43
45
  end
44
46
 
45
- def starting(worker)
47
+ def starting(agent)
46
48
  end
47
49
 
48
- def starting_work(worker, work_unit)
50
+ def starting_work(agent, work_unit)
49
51
  end
50
52
 
51
- def finished_work(worker, work_unit, result)
53
+ def finished_work(agent, work_unit, result)
52
54
  end
53
55
  end
54
56
 
@@ -56,37 +58,37 @@ In your Rakefile
56
58
 
57
59
  DeepTest::TestTask.new "task_name" do |t|
58
60
  ...
59
- t.worker_listener = "MyWorkerListener"
61
+ t.listener = "MyListener"
60
62
  end
61
63
 
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
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
65
67
  loaded, so it is available to be instantiated. You can specify multiple
66
68
  listener classes by separating them with a comma. For more information about
67
69
  when events are triggered, see the documentation at
68
- DeepTest::NullWorkerListener.
70
+ DeepTest::NullListener.
69
71
 
70
72
 
71
- === Setting Up A New Database For Each Worker
73
+ === Setting Up A New Database For Each Agent
72
74
 
73
75
  By default, DeepTest will reinitialize ActiveRecord connections if ActiveRecord
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
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
77
79
  help you. If you're using Rails with Mysql, simply configure DeepTest as
78
80
  follows in your Rakefile:
79
81
 
80
82
  DeepTest::TestTask.new "task_name" do |t|
81
83
  ...
82
- t.worker_listener = "DeepTest::Database::MysqlSetupListener"
84
+ t.listener = "DeepTest::Database::MysqlSetupListener"
83
85
  end
84
86
 
85
87
 
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.
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.
90
92
 
91
93
  If you're using Mysql but not using Rails, you'll have to create a subclass of
92
94
  MysqlSetupListener and override +master_database_config+ and +dump_file_name+,
@@ -103,7 +105,7 @@ project so that it can be included in later releases of DeepTest.
103
105
  In addition to running your tests in parallel, DeepTest can also distribute
104
106
  them across multiple machines. It does this by first mirroring the local
105
107
  working copy that launched the tests on each machine that will be running tests.
106
- Then workers are launched on each of the machines and consume tests in the same
108
+ Then agents are launched on each of the machines and consume tests in the same
107
109
  fashion as when DeepTest is running locally.
108
110
 
109
111
  ==== Requirements
@@ -120,55 +122,23 @@ local development machine. DeepTest must also be installed as a gem on each
120
122
  test machine and available either as a gem or in your project on the local
121
123
  machine.
122
124
 
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>
138
-
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
125
  ==== Configuring Your Project
162
126
 
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.
131
+
163
132
  If you're using rsync over ssh, create a DeepTest test task similar to that
164
133
  below in your Rakefile.
165
134
 
166
135
  DeepTest::TestTask.new "deep_test_distributed" do |t|
167
136
  t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
168
- t.distributed_server = <drb uri of master_test_server>
137
+ t.distributed_hosts = %w[host1 host2]
169
138
  t.sync_options = {
170
139
  :source => <absolute path of project root on machine>,
171
- :username => "username"
140
+ :username => "username",
141
+ :remote_base_dir => <absolute path to keep working copies in on remote machine> # defaults to /tmp
172
142
  }
173
143
  end
174
144
 
@@ -181,7 +151,7 @@ rake task as follows.
181
151
 
182
152
  DeepTest::TestTask.new "deep_test_distributed" do |t|
183
153
  t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
184
- t.distributed_server = <drb uri of master_test_server>
154
+ t.distributed_hosts = %w[host1 host2]
185
155
  t.sync_options = {
186
156
  :source => <name of rsync module from daemon configuration>,
187
157
  :daemon => true,
@@ -189,7 +159,6 @@ rake task as follows.
189
159
  }
190
160
  end
191
161
 
192
-
193
162
  Username is optional in both cases. You'll need to either setup passwordless
194
163
  ssh access or run an rsync daemon that doesn't require passwords.
195
164
 
@@ -210,7 +179,7 @@ least have something like this:
210
179
  That way you can avoid spending any time mirroring tmp and log files that don't
211
180
  have any effect on the tests. If you are running distributed tests against a
212
181
  database, consult the section above about creating a new database for each
213
- worker to see how to configure DeepTest for your project.
182
+ agent to see how to configure DeepTest for your project.
214
183
 
215
184
  Any number of projects can be run using the same test servers, as long as
216
185
  they're all using the same version of Ruby and DeepTest.
@@ -221,6 +190,8 @@ they're all using the same version of Ruby and DeepTest.
221
190
  * Alex Chaffee
222
191
  * Dan[http://www.dcmanges.com/blog] Manges[http://www.dcmanges.com/blog]
223
192
  * 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/]
224
195
  * Scott Taylor
225
196
 
226
197
  == License
data/Rakefile CHANGED
@@ -6,21 +6,22 @@ require 'rake/contrib/sshpublisher'
6
6
  require 'yaml'
7
7
 
8
8
  require 'rubygems'
9
- gem 'rspec', '=1.1.8'
9
+ gem('rspec', ENV['RSPEC_VERSION'] || '1.1.12')
10
10
  require 'spec/rake/spectask'
11
11
 
12
12
  $LOAD_PATH << File.dirname(__FILE__) + "/lib"
13
+
13
14
  require "deep_test/rake_tasks"
14
15
 
15
16
  task :default => %w[
16
17
  test
17
18
  spec
18
- failing_test
19
19
  deep_test
20
- deep_spec
21
- run_distributed
22
- run_distributed_with_worker_down
23
- run_distributed_with_failover
20
+ deep_spec_1.1.8
21
+ deep_spec_1.1.12
22
+ distributed_test
23
+ distributed_spec
24
+ negative_acceptance_tests
24
25
  test_rails_project
25
26
  ]
26
27
 
@@ -32,123 +33,51 @@ Rake::TestTask.new do |t|
32
33
  end
33
34
 
34
35
  DeepTest::TestTask.new :deep_test do |t|
35
- t.number_of_workers = 2
36
36
  t.pattern = "test/**/*_test.rb"
37
- t.metrics_file = "deep_test.metrics"
38
37
  end
39
38
 
40
- DeepTest::TestTask.new(:distributed_test) do |t|
41
- t.number_of_workers = 2
39
+ DeepTest::TestTask.new(:manual_distributed_test) do |t|
42
40
  t.pattern = "test/**/*_test.rb"
43
- t.distributed_server = "druby://localhost:8000"
41
+ t.distributed_hosts = (ENV['HOSTS'] || '').split(' ')
44
42
  t.sync_options = {:source => File.dirname(__FILE__),
45
- :local => true,
43
+ :username => ENV['USERNAME'],
46
44
  :rsync_options => "--exclude=.svn"}
47
45
  end
48
46
 
47
+ DeepTest::TestTask.new(:distributed_test) do |t|
48
+ t.pattern = "test/**/*_test.rb"
49
+ t.distributed_hosts = %w[localhost]
50
+ t.sync_options = {:source => File.dirname(__FILE__),
51
+ :rsync_options => "--exclude=.svn",
52
+ :remote_base_dir => "/tmp/deep_test"}
53
+ end
54
+
49
55
  Spec::Rake::SpecTask.new(:spec) do |t|
50
56
  t.spec_files = FileList['spec/**/*_spec.rb']
51
57
  end
52
58
 
53
59
  Spec::Rake::SpecTask.new(:deep_spec) do |t|
54
60
  t.spec_files = FileList['spec/**/*_spec.rb']
55
- t.deep_test :number_of_workers => 2
61
+ t.deep_test({})
56
62
  end
57
63
 
58
- Spec::Rake::SpecTask.new(:distributed_spec) do |t|
59
- t.spec_files = FileList['spec/**/*_spec.rb']
60
- t.deep_test :number_of_workers => 2,
61
- :distributed_server => "druby://localhost:8000",
62
- :sync_options => {:source => File.dirname(__FILE__),
63
- :local => true,
64
- :rsync_options => "--exclude=.svn"}
64
+ task :'deep_spec_1.1.8' do
65
+ sh 'rake deep_spec RSPEC_VERSION=1.1.8'
65
66
  end
66
67
 
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"}
68
+ task :'deep_spec_1.1.12' do
69
+ sh 'rake deep_spec RSPEC_VERSION=1.1.12'
75
70
  end
76
71
 
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"
72
+ Spec::Rake::SpecTask.new(:distributed_spec) do |t|
73
+ t.spec_files = FileList['spec/**/*_spec.rb']
74
+ t.deep_test :distributed_hosts => %w[localhost],
75
+ :sync_options => {:source => File.dirname(__FILE__),
76
+ :rsync_options => "--exclude=.svn"}
140
77
  end
141
78
 
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
79
+ Rake::TestTask.new(:negative_acceptance_tests) do |t|
80
+ t.pattern = "negative_acceptance_tests/tests.rb"
152
81
  end
153
82
 
154
83
  Rake::TestTask.new(:test_rails_project) do |t|
@@ -163,7 +92,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
163
92
  rdoc.rdoc_files.include(
164
93
  'README.rdoc',
165
94
  'CHANGELOG',
166
- 'lib/deep_test/null_worker_listener.rb',
95
+ 'lib/deep_test/null_listener.rb',
167
96
  'lib/deep_test/database/*.rb'
168
97
  )
169
98
  end
@@ -186,13 +115,27 @@ specification = Gem::Specification.new do |s|
186
115
  s.email = "daniel.manges@gmail.com"
187
116
  s.homepage = "http://deep-test.rubyforge.org"
188
117
  s.rubyforge_project = "deep-test"
189
- s.executables << "deep_test"
190
118
 
191
119
  s.has_rdoc = true
192
120
  s.extra_rdoc_files = ['README.rdoc', 'CHANGELOG']
193
121
  s.rdoc_options << '--title' << "DeepTest" << '--main' << 'README.rdoc' << '--line-numbers'
194
122
 
195
- s.files = FileList['{lib,script,test,bin}/**/*.{rb,rake,rhtml}', 'README.rdoc', 'CHANGELOG', 'Rakefile'].to_a
123
+ s.files = FileList['{lib,test}/**/*.{rb,rake}', 'README.rdoc', 'CHANGELOG', 'Rakefile'].to_a
124
+ end
125
+
126
+ begin
127
+ require 'jeweler'
128
+ Jeweler::Tasks.new do |gemspec|
129
+ gemspec.name = "jstorimer-deep-test"
130
+ gemspec.summary = "DeepTest runs tests in multiple processes."
131
+ gemspec.author = "anonymous z, Dan Manges, David Vollbracht"
132
+ gemspec.description = gemspec.summary
133
+ gemspec.email = "daniel.manges@gmail.com"
134
+ gemspec.homepage = "http://deep-test.rubyforge.org"
135
+ end
136
+ Jeweler::GemcutterTasks.new
137
+ rescue LoadError
138
+ puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
196
139
  end
197
140
 
198
141
  Rake::GemPackageTask.new(specification) do |package|
@@ -205,18 +148,3 @@ Rake::Task[:gem].prerequisites.unshift :default
205
148
  task :tar do
206
149
  system "tar zcf pkg/deep_test.tar.gz --exclude=.svn --exclude='*.tar.gz' --exclude='*.gem' --directory=.. deep_test"
207
150
  end
208
-
209
- begin
210
- require 'jeweler'
211
- Jeweler::Tasks.new do |gemspec|
212
- gemspec.name = "jstorimer-deep-test"
213
- gemspec.summary = "Edge version of deep-test"
214
- gemspec.description = "Parallelized testing"
215
- gemspec.email = "jstorimer@gmail.com"
216
- gemspec.homepage = "http://github.com/qxjit/deep-test/"
217
- gemspec.authors = ["Josh Nichols"]
218
- end
219
- Jeweler::GemcutterTasks.new
220
- rescue LoadError
221
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
222
- end