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.
- data/.gitignore +0 -1
- data/README.rdoc +70 -41
- data/Rakefile +104 -32
- data/TODO +2 -2
- data/VERSION +1 -1
- data/bin/deep_test +15 -0
- data/jstorimer-deep-test-0.1.0.gem +0 -0
- data/jstorimer-deep-test.gemspec +1425 -0
- data/lib/deep_test.rb +40 -28
- data/lib/deep_test/database/mysql_setup_listener.rb +12 -12
- data/lib/deep_test/database/setup_listener.rb +23 -23
- data/lib/deep_test/distributed/dispatch_controller.rb +10 -17
- data/lib/deep_test/distributed/drb_client_connection_info.rb +15 -0
- data/lib/deep_test/distributed/master_test_server.rb +52 -0
- data/lib/deep_test/distributed/multi_test_server_proxy.rb +44 -0
- data/lib/deep_test/distributed/null_work_unit.rb +12 -0
- data/lib/deep_test/distributed/remote_worker_client.rb +54 -0
- data/lib/deep_test/distributed/remote_worker_server.rb +82 -0
- data/lib/deep_test/distributed/rsync.rb +12 -25
- data/lib/deep_test/distributed/show_status.rhtml +41 -0
- data/lib/deep_test/distributed/test_server.rb +78 -0
- data/lib/deep_test/distributed/test_server_status.rb +9 -0
- data/lib/deep_test/distributed/test_server_workers.rb +24 -0
- data/lib/deep_test/distributed/throughput_runner.rb +42 -0
- data/lib/deep_test/distributed/throughput_statistics.rb +26 -0
- data/lib/deep_test/distributed/throughput_worker_client.rb +19 -0
- data/lib/deep_test/extensions/drb_extension.rb +34 -0
- data/lib/deep_test/listener_list.rb +1 -1
- data/lib/deep_test/local_workers.rb +55 -0
- data/lib/deep_test/logger.rb +2 -17
- data/lib/deep_test/marshallable_exception_wrapper.rb +4 -4
- data/lib/deep_test/metrics/gatherer.rb +67 -0
- data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +133 -0
- data/lib/deep_test/{null_listener.rb → null_worker_listener.rb} +14 -14
- data/lib/deep_test/option.rb +60 -0
- data/lib/deep_test/options.rb +42 -45
- data/lib/deep_test/process_orchestrator.rb +49 -0
- data/lib/deep_test/rake_tasks.rb +1 -3
- data/lib/deep_test/result_reader.rb +6 -10
- data/lib/deep_test/rspec_detector.rb +1 -1
- data/lib/deep_test/server.rb +75 -0
- data/lib/deep_test/spec.rb +1 -5
- data/lib/deep_test/spec/extensions/example_methods.rb +1 -7
- data/lib/deep_test/spec/extensions/reporter.rb +29 -0
- data/lib/deep_test/spec/extensions/spec_task.rb +2 -3
- data/lib/deep_test/spec/runner.rb +17 -32
- data/lib/deep_test/spec/work_result.rb +0 -2
- data/lib/deep_test/test/runner.rb +2 -2
- data/lib/deep_test/test/supervised_test_suite.rb +10 -9
- data/lib/deep_test/test/work_result.rb +0 -1
- data/lib/deep_test/test_task.rb +1 -1
- data/lib/deep_test/ui/console.rb +11 -9
- data/lib/deep_test/warlock.rb +25 -37
- data/lib/deep_test/worker.rb +57 -0
- data/sample_rails_project/deep_test.rb +0 -4
- data/sample_rails_project/lib/{foreign_host_agent_simulation_listener.rb → foreign_host_worker_simulation_listener.rb} +4 -6
- data/sample_rails_project/lib/tasks/deep_test.rake +4 -13
- data/script/internal/run_test_suite.rb +7 -0
- data/script/public/master_test_server.rb +24 -0
- data/script/public/test_server.rb +18 -0
- data/script/public/test_throughput.rb +29 -0
- data/spec/deep_test/option_spec.rb +33 -0
- data/spec/deep_test/options_spec.rb +59 -80
- data/spec/deep_test/spec/extensions/example_methods_spec.rb +4 -5
- data/spec/deep_test/spec/extensions/spec_task_spec.rb +6 -4
- data/spec/deep_test/spec/runner_spec.rb +32 -59
- data/spec/spec_helper.rb +6 -14
- data/spec/thread_worker.rb +25 -0
- data/test/deep_test/database/mysql_setup_listener_test.rb +9 -13
- data/test/deep_test/distributed/dispatch_controller_test.rb +177 -130
- data/test/deep_test/distributed/drb_client_connection_info_test.rb +42 -0
- data/test/deep_test/distributed/filename_resolver_test.rb +34 -38
- data/test/deep_test/distributed/master_test_server_test.rb +32 -0
- data/test/deep_test/distributed/multi_test_server_proxy_test.rb +96 -0
- data/test/deep_test/distributed/remote_worker_client_test.rb +180 -0
- data/test/deep_test/distributed/remote_worker_server_test.rb +99 -0
- data/test/deep_test/distributed/rsync_test.rb +62 -42
- data/test/deep_test/distributed/test_server_test.rb +94 -0
- data/test/deep_test/distributed/test_server_workers_test.rb +26 -0
- data/test/deep_test/distributed/throughput_runner_test.rb +68 -0
- data/test/deep_test/distributed/throughput_worker_client_test.rb +28 -0
- data/test/deep_test/listener_list_test.rb +15 -17
- data/test/deep_test/local_workers_test.rb +22 -0
- data/test/deep_test/logger_test.rb +7 -34
- data/test/deep_test/marshallable_exception_wrapper_test.rb +29 -31
- data/test/deep_test/metrics/gatherer_test.rb +66 -0
- data/test/deep_test/process_orchestrator_test.rb +11 -0
- data/test/deep_test/result_reader_test.rb +95 -95
- data/test/deep_test/server_test.rb +58 -0
- data/test/deep_test/test/extensions/error_test.rb +36 -38
- data/test/deep_test/test/runner_test.rb +3 -7
- data/test/deep_test/test/supervised_test_suite_test.rb +61 -89
- data/test/deep_test/test/work_result_test.rb +76 -80
- data/test/deep_test/test/work_unit_test.rb +51 -53
- data/test/deep_test/test_task_test.rb +38 -10
- data/test/deep_test/ui/console_test.rb +4 -8
- data/test/deep_test/warlock_test.rb +31 -33
- data/test/deep_test/worker_test.rb +94 -0
- data/test/failing.rake +11 -0
- data/{negative_acceptance_tests/failing_test.rb → test/failing.rb} +1 -3
- data/{infrastructure → test}/fake_deadlock_error.rb +0 -0
- data/test/simple_test_blackboard.rb +45 -0
- data/test/simple_test_blackboard_test.rb +33 -0
- data/{infrastructure → test}/test_factory.rb +0 -0
- data/test/test_helper.rb +5 -20
- data/test/test_task_test.rb +57 -60
- metadata +78 -87
- data/infrastructure/dynamic_teardown.rb +0 -22
- data/infrastructure/load.rb +0 -11
- data/infrastructure/test_central_command.rb +0 -15
- data/infrastructure/test_exception.rb +0 -7
- data/infrastructure/test_logger.rb +0 -11
- data/infrastructure/test_operator.rb +0 -15
- data/infrastructure/test_result.rb +0 -15
- data/infrastructure/thread_agent.rb +0 -21
- data/infrastructure/timewarp/Rakefile +0 -14
- data/infrastructure/timewarp/lib/timewarp.rb +0 -21
- data/infrastructure/timewarp/test/timewarp_test.rb +0 -45
- data/lib/deep_test/agent.rb +0 -108
- data/lib/deep_test/central_command.rb +0 -165
- data/lib/deep_test/cpu_info.rb +0 -22
- data/lib/deep_test/demon.rb +0 -25
- data/lib/deep_test/distributed/beachhead.rb +0 -104
- data/lib/deep_test/distributed/establish_beachhead.rb +0 -19
- data/lib/deep_test/distributed/landing_fleet.rb +0 -30
- data/lib/deep_test/distributed/landing_ship.rb +0 -60
- data/lib/deep_test/distributed/remote_deployment.rb +0 -56
- data/lib/deep_test/distributed/shell_environment.rb +0 -50
- data/lib/deep_test/distributed/ssh_client_connection_info.rb +0 -14
- data/lib/deep_test/failure_message.rb +0 -19
- data/lib/deep_test/lib_root.rb +0 -4
- data/lib/deep_test/local_deployment.rb +0 -46
- data/lib/deep_test/main.rb +0 -41
- data/lib/deep_test/metrics/data.rb +0 -34
- data/lib/deep_test/metrics/measurement.rb +0 -39
- data/lib/deep_test/proxy_io.rb +0 -77
- data/lib/deep_test/test/run_test_suite.rb +0 -5
- data/lib/telegraph.rb +0 -29
- data/lib/telegraph/ack_sequence.rb +0 -14
- data/lib/telegraph/logging.rb +0 -20
- data/lib/telegraph/message.rb +0 -39
- data/lib/telegraph/operator.rb +0 -47
- data/lib/telegraph/switchboard.rb +0 -57
- data/lib/telegraph/wire.rb +0 -73
- data/negative_acceptance_tests/dying_spec.rb +0 -13
- data/negative_acceptance_tests/dying_test.rb +0 -13
- data/negative_acceptance_tests/failing_spec.rb +0 -9
- data/negative_acceptance_tests/kill_agent_one_on_start_work.rb +0 -16
- data/negative_acceptance_tests/passing_spec.rb +0 -10
- data/negative_acceptance_tests/passing_test.rb +0 -12
- data/negative_acceptance_tests/tasks.rake +0 -87
- data/negative_acceptance_tests/tests.rb +0 -60
- data/test/deep_test/agent_test.rb +0 -175
- data/test/deep_test/central_command_test.rb +0 -147
- data/test/deep_test/cpu_info_test.rb +0 -33
- data/test/deep_test/demon_test.rb +0 -23
- data/test/deep_test/distributed/beachhead_test.rb +0 -67
- data/test/deep_test/distributed/landing_fleet_test.rb +0 -55
- data/test/deep_test/distributed/landing_ship_test.rb +0 -48
- data/test/deep_test/distributed/remote_deployment_test.rb +0 -134
- data/test/deep_test/distributed/shell_environment_fixtures/set_bar_to_foo +0 -1
- data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_bar +0 -1
- data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_baz +0 -1
- data/test/deep_test/distributed/shell_environment_test.rb +0 -108
- data/test/deep_test/distributed/ssh_client_connection_info_test.rb +0 -34
- data/test/deep_test/local_deployment_test.rb +0 -19
- data/test/deep_test/main_test.rb +0 -12
- data/test/deep_test/metrics/data_test.rb +0 -22
- data/test/deep_test/metrics/measurement_test.rb +0 -18
- data/test/deep_test/proxy_io_test.rb +0 -104
data/.gitignore
CHANGED
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.
|
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 :
|
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
|
40
|
-
class
|
37
|
+
In my_worker_listener.rb
|
38
|
+
class MyWorkerListener
|
41
39
|
def before_sync
|
42
40
|
end
|
43
41
|
|
44
|
-
def
|
42
|
+
def before_starting_workers
|
45
43
|
end
|
46
44
|
|
47
|
-
def starting(
|
45
|
+
def starting(worker)
|
48
46
|
end
|
49
47
|
|
50
|
-
def starting_work(
|
48
|
+
def starting_work(worker, work_unit)
|
51
49
|
end
|
52
50
|
|
53
|
-
def finished_work(
|
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.
|
59
|
+
t.worker_listener = "MyWorkerListener"
|
62
60
|
end
|
63
61
|
|
64
|
-
An instance of
|
65
|
-
started, and will receive events from that
|
66
|
-
that the
|
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::
|
68
|
+
DeepTest::NullWorkerListener.
|
71
69
|
|
72
70
|
|
73
|
-
=== Setting Up A New Database For Each
|
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
|
77
|
-
against the same database. You may want each
|
78
|
-
decidicated to it. To facilitate this, DeepTest provides a
|
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.
|
82
|
+
t.worker_listener = "DeepTest::Database::MysqlSetupListener"
|
85
83
|
end
|
86
84
|
|
87
85
|
|
88
|
-
Before spawning
|
89
|
-
current Rails environment (usually test). As each
|
90
|
-
listener will create a database dedicated to that
|
91
|
-
into it. The database will be dropped when the
|
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
|
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
|
-
====
|
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
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
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.
|
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.
|
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
|
-
|
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
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
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.
|
43
|
+
t.distributed_server = "druby://localhost:8000"
|
50
44
|
t.sync_options = {:source => File.dirname(__FILE__),
|
51
|
-
:
|
52
|
-
:
|
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 :
|
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
|
-
|
80
|
-
t.
|
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/
|
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
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
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
|