deep_test 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +15 -5
- data/README +149 -5
- data/Rakefile +131 -11
- data/bin/deep_test +15 -0
- data/lib/deep_test.rb +62 -4
- data/lib/deep_test/database/mysql_setup_listener.rb +109 -0
- data/lib/deep_test/database/setup_listener.rb +116 -0
- data/lib/deep_test/distributed/dispatch_controller.rb +53 -0
- data/lib/deep_test/distributed/drb_client_connection_info.rb +15 -0
- data/lib/deep_test/distributed/filename_resolver.rb +40 -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 +37 -0
- 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/extensions/object_extension.rb +8 -0
- data/lib/deep_test/listener_list.rb +17 -0
- data/lib/deep_test/local_workers.rb +55 -0
- data/lib/deep_test/logger.rb +10 -2
- data/lib/deep_test/marshallable_exception_wrapper.rb +44 -0
- 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_worker_listener.rb +50 -0
- data/lib/deep_test/option.rb +60 -0
- data/lib/deep_test/options.rb +61 -24
- data/lib/deep_test/process_orchestrator.rb +31 -78
- data/lib/deep_test/rake_tasks.rb +3 -0
- data/lib/deep_test/result_reader.rb +36 -0
- data/lib/deep_test/rspec_detector.rb +15 -8
- data/lib/deep_test/server.rb +68 -4
- data/lib/deep_test/spec.rb +1 -0
- data/lib/deep_test/spec/extensions/example_group_methods.rb +37 -11
- data/lib/deep_test/spec/extensions/example_methods.rb +46 -0
- data/lib/deep_test/spec/extensions/options.rb +35 -3
- data/lib/deep_test/spec/runner.rb +19 -10
- data/lib/deep_test/spec/work_result.rb +12 -9
- data/lib/deep_test/spec/work_unit.rb +12 -7
- data/lib/deep_test/test.rb +1 -1
- data/lib/deep_test/test/extensions/error.rb +7 -7
- data/lib/deep_test/test/runner.rb +1 -6
- data/lib/deep_test/test/supervised_test_suite.rb +19 -16
- data/lib/deep_test/test/work_result.rb +34 -0
- data/lib/deep_test/test/work_unit.rb +6 -2
- data/lib/deep_test/test_task.rb +15 -35
- data/lib/deep_test/ui/console.rb +76 -0
- data/lib/deep_test/ui/null.rb +17 -0
- data/lib/deep_test/warlock.rb +92 -17
- data/lib/deep_test/worker.rb +38 -2
- 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/test/deep_test/database/mysql_setup_listener_test.rb +14 -0
- data/test/deep_test/distributed/dispatch_controller_test.rb +209 -0
- data/test/deep_test/distributed/drb_client_connection_info_test.rb +42 -0
- data/test/deep_test/distributed/filename_resolver_test.rb +52 -0
- 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 +67 -0
- 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 +20 -0
- data/test/deep_test/local_workers_test.rb +22 -0
- data/test/{logger_test.rb → deep_test/logger_test.rb} +2 -2
- data/test/deep_test/marshallable_exception_wrapper_test.rb +44 -0
- 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 +128 -0
- data/test/deep_test/server_test.rb +58 -0
- data/test/deep_test/test/extensions/error_test.rb +40 -0
- data/test/deep_test/test/supervised_test_suite_test.rb +19 -29
- data/test/deep_test/test/work_result_test.rb +81 -0
- data/test/deep_test/test/work_unit_test.rb +15 -4
- data/test/deep_test/test_task_test.rb +10 -0
- data/test/deep_test/ui/console_test.rb +9 -0
- data/test/deep_test/warlock_test.rb +17 -0
- data/test/deep_test/worker_test.rb +32 -0
- data/test/simple_test_blackboard.rb +2 -1
- data/test/test_helper.rb +1 -0
- metadata +117 -59
- data/lib/deep_test/rinda_blackboard.rb +0 -26
- data/lib/deep_test/test/extensions/test_result.rb +0 -17
- data/lib/deep_test/tuple_space_factory.rb +0 -12
- data/script/run_test_suite.rb +0 -5
- data/test/deep_test/rinda_blackboard_test.rb +0 -15
- data/test/deep_test/test/extensions/test_result_test.rb +0 -71
data/CHANGELOG
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
1.2.0 (March 28, 2008)
|
|
2
|
+
|
|
3
|
+
* Added capability to run distributed
|
|
4
|
+
* Changed to use straight DRb instead of Rinda (performance)
|
|
5
|
+
* Changed error raised on before/after(:all) to warning
|
|
6
|
+
* Added worker listener to setup mysql database for each worker
|
|
7
|
+
* Run test server in same process
|
|
8
|
+
* Check rspec version when loading rspec support
|
|
9
|
+
* Add support for multiple worker listeners
|
|
10
|
+
|
|
11
|
+
1.1.4 (March 11, 2008)
|
|
2
12
|
|
|
3
13
|
* Fixed 2 RSpec pending example bugs
|
|
4
14
|
* Fixed setting spec_opts with DeepTest bug
|
|
@@ -6,21 +16,21 @@
|
|
|
6
16
|
* Added server_port to configuration options
|
|
7
17
|
* Wait for signal from server indicating it is ready on startup
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
1.1.3 (March 10, 2008)
|
|
10
20
|
|
|
11
21
|
* Added Support for RSpec
|
|
12
22
|
* Added DeepTest::TestTask#timeout_in_seconds to configure Rinda IO timeouts
|
|
13
23
|
* Added worker_listener to configuration options
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
1.1.2 (February 9, 2008)
|
|
16
26
|
|
|
17
27
|
* Fix bug with run_test_suite script not exiting with correct exit code.
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
1.1.1 (February 9, 2008)
|
|
20
30
|
|
|
21
31
|
* No longer fork from Rake process.
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
1.1.0 (December 23, 2007)
|
|
24
34
|
|
|
25
35
|
* DeepTest::TestTask#processes= is now DeepTest::TestTask#number_of_workers=
|
|
26
36
|
* No longer depend on the Daemons gem, use DeepTest::Warlock instead.
|
data/README
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
= DeepTest
|
|
2
2
|
|
|
3
|
-
DeepTest enables tests to run in parallel using multiple processes.
|
|
3
|
+
DeepTest enables tests to run in parallel using multiple processes. Processes
|
|
4
|
+
may spawned locally to take advantage of multiple processors on a single
|
|
5
|
+
machine or distributed across many machines to take advantage of distributed
|
|
6
|
+
processing.
|
|
4
7
|
|
|
5
8
|
== Usage
|
|
6
9
|
|
|
@@ -28,10 +31,16 @@ In your Rakefile:
|
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
=== Specifying a Listener to be Notified of Events
|
|
32
35
|
|
|
33
36
|
In my_worker_listener.rb
|
|
34
37
|
class MyWorkerListener
|
|
38
|
+
def before_sync
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def before_starting_workers
|
|
42
|
+
end
|
|
43
|
+
|
|
35
44
|
def starting(worker)
|
|
36
45
|
end
|
|
37
46
|
|
|
@@ -45,14 +54,148 @@ In my_worker_listener.rb
|
|
|
45
54
|
In your Rakefile
|
|
46
55
|
|
|
47
56
|
DeepTest::TestTask.new "task_name" do |t|
|
|
48
|
-
|
|
57
|
+
...
|
|
49
58
|
t.worker_listener = "MyWorkerListener"
|
|
50
59
|
end
|
|
51
60
|
|
|
52
61
|
An instance of MyWorkerListener will be created for each worker that is
|
|
53
62
|
started, and will receive events from that worker. However, you must ensure
|
|
54
63
|
that the MyWorkerListener class is loaded at the time that the test files are
|
|
55
|
-
loaded, so it is available to be instantiated.
|
|
64
|
+
loaded, so it is available to be instantiated. You can specify multiple
|
|
65
|
+
listener classes by separating them with a comma. For more information about
|
|
66
|
+
when events are triggered, see the documentation at
|
|
67
|
+
DeepTest::NullWorkerListener.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
=== Setting Up A New Database For Each Worker
|
|
71
|
+
|
|
72
|
+
By default, DeepTest will reinitialize ActiveRecord connections if ActiveRecord
|
|
73
|
+
is loaded when the workers are started. This means all workers are running
|
|
74
|
+
against the same database. You may want each worker to use a database
|
|
75
|
+
decidicated to it. To facilitate this, DeepTest provides a worker listener to
|
|
76
|
+
help you. If you're using Rails with Mysql, simply configure DeepTest as
|
|
77
|
+
follows in your Rakefile:
|
|
78
|
+
|
|
79
|
+
DeepTest::TestTask.new "task_name" do |t|
|
|
80
|
+
...
|
|
81
|
+
t.worker_listener = "DeepTest::Database::MysqlSetupListener"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
Before spawning workers, DeepTest will dump the schema of the database for the
|
|
86
|
+
current Rails environment (usually test). As each worker starts up, the
|
|
87
|
+
listener will create a database dedicated to that worker and load the schema
|
|
88
|
+
into it. The database will be dropped when the worker process exits.
|
|
89
|
+
|
|
90
|
+
If you're using Mysql but not using Rails, you'll have to create a subclass of
|
|
91
|
+
MysqlSetupListener and override +master_database_config+ and +dump_file_name+,
|
|
92
|
+
as the default implementations of these methods are Rails specific.
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
If you're using a database other than Mysql, read the documentation for
|
|
96
|
+
DeepTest::Database::SetupListener and create a new subclass for your database
|
|
97
|
+
type. If you do this, please consider contributing your subclass back to the
|
|
98
|
+
project so that it can be included in later releases of DeepTest.
|
|
99
|
+
|
|
100
|
+
=== Distributing Tests Across Multiple Machines
|
|
101
|
+
|
|
102
|
+
In addition to running your tests in parallel, DeepTest can also distribute
|
|
103
|
+
them across multiple machines. It does this by first mirroring the local
|
|
104
|
+
working copy that launched the tests on each machine that will be running tests.
|
|
105
|
+
Then workers are launched on each of the machines and consume tests in the same
|
|
106
|
+
fashion as when DeepTest is running locally.
|
|
107
|
+
|
|
108
|
+
==== Requirements
|
|
109
|
+
|
|
110
|
+
Before you can distribute tests, you must ensure that all the machines involved
|
|
111
|
+
(including the machine with the local working copy) have rsync installed for
|
|
112
|
+
mirroring working copies. You must also have either SSH or an RSync daemon
|
|
113
|
+
exposing your local working copy running on the local development machine. For
|
|
114
|
+
more information about rsync, visit the rsync
|
|
115
|
+
webpage[http://www.samba.org/rsync/]. Currently only passwordless access is
|
|
116
|
+
supported, so you must either setup your RSync daemon to be accessible without
|
|
117
|
+
a password or enable passwordless SSH access from the test machines to the
|
|
118
|
+
local development machine. DeepTest must also be installed as a gem on each
|
|
119
|
+
test machine and available either as a gem or in your project on the local
|
|
120
|
+
machine.
|
|
121
|
+
|
|
122
|
+
==== Starting a Test Server
|
|
123
|
+
|
|
124
|
+
On each test machine, execute the following:
|
|
125
|
+
> deep_test test_server
|
|
126
|
+
|
|
127
|
+
This will launch a server providing mirroring and worker services. By default,
|
|
128
|
+
2 workers will be launched for each set of tests run. If you wish to change
|
|
129
|
+
the number of workers, simply specify the --number_of_workers option. For
|
|
130
|
+
information about what options are available, use -h. The test_server will
|
|
131
|
+
print out the uri it is bound to, druby://<hostname>:4022 by default.
|
|
132
|
+
|
|
133
|
+
==== Starting a Master Test Server
|
|
134
|
+
|
|
135
|
+
On a single machine (probably one of the test machines), execute this:
|
|
136
|
+
> deep_test master_test_server <uris of test servers>
|
|
137
|
+
|
|
138
|
+
The master_test_server will also print it's binding uri,
|
|
139
|
+
druby://<hostname>:4021 by default. It will also provide a webserver bound
|
|
140
|
+
to port 4020 that provides a status page summarizing the state of all the
|
|
141
|
+
test servers.
|
|
142
|
+
|
|
143
|
+
==== Configuring Your Project
|
|
144
|
+
|
|
145
|
+
If you're using rsync over ssh, create a DeepTest test task similar to that
|
|
146
|
+
below in your Rakefile.
|
|
147
|
+
|
|
148
|
+
DeepTest::TestTask.new "deep_test_distributed" do |t|
|
|
149
|
+
t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
|
|
150
|
+
t.distributed_server = <drb uri of master_test_server>
|
|
151
|
+
t.sync_options = {
|
|
152
|
+
:source => <absolute path of project root on machine>,
|
|
153
|
+
:username => "username"
|
|
154
|
+
}
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
The :source entry in sync_options can be easily calculated based on the value
|
|
158
|
+
of \_\_FILE__ when defining the task. :username will be used by rsync to ssh
|
|
159
|
+
back to the local machine and mirror the working copy.
|
|
160
|
+
|
|
161
|
+
If you have an rsync daemon running in your local machine, configure the
|
|
162
|
+
rake task as follows.
|
|
163
|
+
|
|
164
|
+
DeepTest::TestTask.new "deep_test_distributed" do |t|
|
|
165
|
+
t.pattern = "test/**/*_test.rb" # whatever is appropriate for your project
|
|
166
|
+
t.distributed_server = <drb uri of master_test_server>
|
|
167
|
+
t.sync_options = {
|
|
168
|
+
:source => <name of rsync module from daemon configuration>,
|
|
169
|
+
:daemon => true,
|
|
170
|
+
:username => "username"
|
|
171
|
+
}
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Username is optional in both cases. You'll need to either setup passwordless
|
|
176
|
+
ssh access or run an rsync daemon that doesn't require passwords.
|
|
177
|
+
|
|
178
|
+
There may be other options you'd like to pass to rsync in your particular
|
|
179
|
+
scenario. This can be done by adding an :rsync_options entry to sync_options.
|
|
180
|
+
For example, if you're working on a Rails project you'll probably want to at
|
|
181
|
+
least have something like this:
|
|
182
|
+
|
|
183
|
+
DeepTest::TestTask.new "deep_test_distributed" do |t|
|
|
184
|
+
...
|
|
185
|
+
excludes = %w[.svn tmp/** log/**]
|
|
186
|
+
t.sync_options = {
|
|
187
|
+
...
|
|
188
|
+
:rsync_options => excludes.map {|s| "'--exclude=#{s}'"}.join(' ')
|
|
189
|
+
}
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
That way you can avoid spending any time mirroring tmp and log files that don't
|
|
193
|
+
have any effect on the tests. If you are running distributed tests against a
|
|
194
|
+
database, consult the section above about creating a new database for each
|
|
195
|
+
worker to see how to configure DeepTest for your project.
|
|
196
|
+
|
|
197
|
+
Any number of projects can be run using the same test servers, as long as
|
|
198
|
+
they're all using the same version of Ruby and DeepTest.
|
|
56
199
|
|
|
57
200
|
== Contributors
|
|
58
201
|
|
|
@@ -63,4 +206,5 @@ loaded, so it is available to be instantiated.
|
|
|
63
206
|
* Scott Taylor
|
|
64
207
|
|
|
65
208
|
== License
|
|
66
|
-
|
|
209
|
+
|
|
210
|
+
DeepTest Released under Ruby's[http://www.ruby-lang.org/en/LICENSE.txt] license[http://www.ruby-lang.org/en/LICENSE.txt]
|
data/Rakefile
CHANGED
|
@@ -6,25 +6,136 @@ require 'rake/contrib/sshpublisher'
|
|
|
6
6
|
$LOAD_PATH << File.dirname(__FILE__) + "/lib"
|
|
7
7
|
require "deep_test/rake_tasks"
|
|
8
8
|
|
|
9
|
-
task :default => %w[
|
|
9
|
+
task :default => %w[
|
|
10
|
+
test
|
|
11
|
+
spec
|
|
12
|
+
failing_test
|
|
13
|
+
deep_test
|
|
14
|
+
deep_spec
|
|
15
|
+
run_distributed
|
|
16
|
+
run_distributed_with_worker_down
|
|
17
|
+
run_distributed_with_failover
|
|
18
|
+
test_rails_project
|
|
19
|
+
]
|
|
10
20
|
|
|
11
21
|
Rake::TestTask.new do |t|
|
|
12
22
|
t.pattern = "test/**/*_test.rb"
|
|
13
23
|
t.libs += ['test', 'lib']
|
|
14
24
|
end
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
t.
|
|
26
|
+
DeepTest::TestTask.new :deep_test do |t|
|
|
27
|
+
t.number_of_workers = 2
|
|
28
|
+
t.pattern = "test/**/*_test.rb"
|
|
29
|
+
t.metrics_file = "deep_test.metrics"
|
|
18
30
|
end
|
|
19
31
|
|
|
20
|
-
DeepTest::TestTask.new
|
|
32
|
+
DeepTest::TestTask.new(:distributed_test) do |t|
|
|
21
33
|
t.number_of_workers = 2
|
|
22
34
|
t.pattern = "test/**/*_test.rb"
|
|
35
|
+
t.distributed_server = "druby://localhost:8000"
|
|
36
|
+
t.sync_options = {:source => File.dirname(__FILE__),
|
|
37
|
+
:local => true,
|
|
38
|
+
:rsync_options => "--exclude=.svn"}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def rspec_present?
|
|
42
|
+
defined?(Spec)
|
|
23
43
|
end
|
|
24
44
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
if rspec_present?
|
|
46
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
|
47
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Spec::Rake::SpecTask.new(:deep_spec) do |t|
|
|
51
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
52
|
+
t.deep_test :number_of_workers => 2
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
Spec::Rake::SpecTask.new(:distributed_spec) do |t|
|
|
56
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
|
57
|
+
t.deep_test :number_of_workers => 2,
|
|
58
|
+
:distributed_server => "druby://localhost:8000",
|
|
59
|
+
:sync_options => {:source => File.dirname(__FILE__),
|
|
60
|
+
:local => true,
|
|
61
|
+
:rsync_options => "--exclude=.svn"}
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
DeepTest::TestTask.new(:distribute_tests_to_minis) do |t|
|
|
67
|
+
t.number_of_workers = 2
|
|
68
|
+
t.pattern = "test/**/*_test.rb"
|
|
69
|
+
t.distributed_server = "druby://alpha.local:8000"
|
|
70
|
+
t.sync_options = {:source => File.dirname(__FILE__),
|
|
71
|
+
:username => "tworker",
|
|
72
|
+
:password => "thought",
|
|
73
|
+
:rsync_options => "--exclude=.svn"}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
task :run_distributed do |t|
|
|
77
|
+
begin
|
|
78
|
+
FileUtils.mkdir('/tmp/test_1') unless File.exist?('/tmp/test_1')
|
|
79
|
+
FileUtils.mkdir('/tmp/test_2') unless File.exist?('/tmp/test_2')
|
|
80
|
+
|
|
81
|
+
test_1_pid = fork do
|
|
82
|
+
exec "ruby bin/deep_test test_server --uri drubyall://localhost:8001 --work_dir /tmp/test_1"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
test_2_pid = fork do
|
|
86
|
+
exec "ruby bin/deep_test test_server --uri drubyall://localhost:8002 --work_dir /tmp/test_2"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
master_pid = fork do
|
|
90
|
+
exec "ruby bin/deep_test master_test_server --uri drubyall://localhost:8000 druby://localhost:8001 druby://localhost:8002"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
sleep 1
|
|
94
|
+
|
|
95
|
+
Rake::Task[:distributed_test].invoke
|
|
96
|
+
Rake::Task[:distributed_spec].invoke
|
|
97
|
+
|
|
98
|
+
sh "ruby bin/deep_test test_throughput druby://localhost:8000 20"
|
|
99
|
+
ensure
|
|
100
|
+
Process.kill('TERM', master_pid) if master_pid rescue nil
|
|
101
|
+
Process.kill('TERM', test_1_pid) if test_1_pid rescue nil
|
|
102
|
+
Process.kill('TERM', test_2_pid) if test_2_pid rescue nil
|
|
103
|
+
Process.waitall
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
sleep 1
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
task :run_distributed_with_worker_down do |t|
|
|
110
|
+
begin
|
|
111
|
+
FileUtils.mkdir('/tmp/test_1') unless File.exist?('/tmp/test_1')
|
|
112
|
+
|
|
113
|
+
test_1_pid = fork do
|
|
114
|
+
exec "ruby bin/deep_test test_server --uri drubyall://localhost:8001 --work_dir /tmp/test_1"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# don't start worker 2
|
|
118
|
+
|
|
119
|
+
master_pid = fork do
|
|
120
|
+
exec "ruby bin/deep_test master_test_server --uri drubyall://localhost:8000 druby://localhost:8001 druby://localhost:8002"
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
sleep 1
|
|
124
|
+
|
|
125
|
+
# Use throughput to make sure we can run tests
|
|
126
|
+
sh "ruby bin/deep_test test_throughput druby://localhost:8000 20"
|
|
127
|
+
ensure
|
|
128
|
+
Process.kill('TERM', master_pid) if master_pid rescue nil
|
|
129
|
+
Process.kill('TERM', test_1_pid) if test_1_pid rescue nil
|
|
130
|
+
Process.waitall
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
task :run_distributed_with_failover do |t|
|
|
135
|
+
puts
|
|
136
|
+
puts "*** Running distributed with no server - expect a failover message ***"
|
|
137
|
+
puts
|
|
138
|
+
Rake::Task[:distributed_spec].execute
|
|
28
139
|
end
|
|
29
140
|
|
|
30
141
|
task :failing_test do
|
|
@@ -39,12 +150,21 @@ task :failing_test do
|
|
|
39
150
|
end
|
|
40
151
|
end
|
|
41
152
|
|
|
153
|
+
Rake::TestTask.new(:test_rails_project) do |t|
|
|
154
|
+
t.pattern = "sample_rails_project/deep_test.rb"
|
|
155
|
+
end
|
|
156
|
+
|
|
42
157
|
desc "Generate documentation"
|
|
43
158
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
44
159
|
rdoc.rdoc_dir = "doc"
|
|
45
160
|
rdoc.title = "DeepTest"
|
|
46
161
|
rdoc.options << '--line-numbers'
|
|
47
|
-
rdoc.rdoc_files.include(
|
|
162
|
+
rdoc.rdoc_files.include(
|
|
163
|
+
'README',
|
|
164
|
+
'CHANGELOG',
|
|
165
|
+
'lib/deep_test/null_worker_listener.rb',
|
|
166
|
+
'lib/deep_test/database/*.rb'
|
|
167
|
+
)
|
|
48
168
|
end
|
|
49
169
|
|
|
50
170
|
desc "Upload RDoc to RubyForge"
|
|
@@ -58,19 +178,19 @@ specification = Gem::Specification.new do |s|
|
|
|
58
178
|
s.platform = Gem::Platform::RUBY
|
|
59
179
|
s.name = "deep_test"
|
|
60
180
|
s.summary = "DeepTest runs tests in multiple processes."
|
|
61
|
-
s.version = "1.
|
|
181
|
+
s.version = "1.2.0"
|
|
62
182
|
s.author = "anonymous z, Dan Manges, David Vollbracht"
|
|
63
183
|
s.description = s.summary
|
|
64
184
|
s.email = "daniel.manges@gmail.com"
|
|
65
185
|
s.homepage = "http://deep-test.rubyforge.org"
|
|
66
186
|
s.rubyforge_project = "deep-test"
|
|
187
|
+
s.executables << "deep_test"
|
|
67
188
|
|
|
68
189
|
s.has_rdoc = true
|
|
69
190
|
s.extra_rdoc_files = ['README', 'CHANGELOG']
|
|
70
191
|
s.rdoc_options << '--title' << "DeepTest" << '--main' << 'README' << '--line-numbers'
|
|
71
192
|
|
|
72
|
-
s.
|
|
73
|
-
s.files = FileList['{lib,script,test}/**/*.{rb,rake}', 'README', 'CHANGELOG', 'Rakefile'].to_a
|
|
193
|
+
s.files = FileList['{lib,script,test,bin}/**/*.{rb,rake,rhtml}', 'README', 'CHANGELOG', 'Rakefile'].to_a
|
|
74
194
|
end
|
|
75
195
|
|
|
76
196
|
Rake::GemPackageTask.new(specification) do |package|
|
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
|
data/lib/deep_test.rb
CHANGED
|
@@ -4,29 +4,87 @@ module DeepTest
|
|
|
4
4
|
@logger ||= DeepTest::Logger.new($stdout)
|
|
5
5
|
end
|
|
6
6
|
end
|
|
7
|
+
|
|
8
|
+
# Fork in a separate thread. If we fork from a DRb thread
|
|
9
|
+
# (a thread handling a method call invoked over drb),
|
|
10
|
+
# DRb still thinks the current object is the DRb Front Object,
|
|
11
|
+
# and reports its uri as the same as in the parent process, even
|
|
12
|
+
# if you restart DRb service.
|
|
13
|
+
#
|
|
14
|
+
def self.drb_safe_fork(&block)
|
|
15
|
+
Thread.new {Process.fork(&block)}.value
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.init(options)
|
|
19
|
+
return if @initialized
|
|
20
|
+
@initialized = true
|
|
21
|
+
Metrics::Gatherer.setup(options)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class WorkUnitNeverReceivedError < StandardError
|
|
25
|
+
def initialize
|
|
26
|
+
super "DeepTest result never received. Maybe an error was printed above?"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def backtrace
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
7
33
|
end
|
|
8
34
|
|
|
9
35
|
require "logger"
|
|
10
|
-
require "
|
|
11
|
-
require "
|
|
36
|
+
require "drb"
|
|
37
|
+
require "timeout"
|
|
38
|
+
require "thread"
|
|
39
|
+
require "socket"
|
|
40
|
+
require "webrick"
|
|
41
|
+
require "timeout"
|
|
12
42
|
|
|
13
43
|
require File.dirname(__FILE__) + "/deep_test/extensions/object_extension"
|
|
44
|
+
require File.dirname(__FILE__) + "/deep_test/extensions/drb_extension"
|
|
14
45
|
|
|
15
46
|
require File.dirname(__FILE__) + "/deep_test/deadlock_detector"
|
|
16
|
-
require File.dirname(__FILE__) + "/deep_test/
|
|
17
|
-
require File.dirname(__FILE__) + "/deep_test/rinda_blackboard"
|
|
47
|
+
require File.dirname(__FILE__) + "/deep_test/local_workers"
|
|
18
48
|
require File.dirname(__FILE__) + "/deep_test/logger"
|
|
49
|
+
|
|
50
|
+
require File.dirname(__FILE__) + "/deep_test/marshallable_exception_wrapper"
|
|
19
51
|
require File.dirname(__FILE__) + "/deep_test/null_worker_listener"
|
|
52
|
+
require File.dirname(__FILE__) + "/deep_test/listener_list"
|
|
53
|
+
require File.dirname(__FILE__) + "/deep_test/option"
|
|
20
54
|
require File.dirname(__FILE__) + "/deep_test/options"
|
|
21
55
|
require File.dirname(__FILE__) + "/deep_test/process_orchestrator"
|
|
56
|
+
require File.dirname(__FILE__) + "/deep_test/result_reader"
|
|
22
57
|
require File.dirname(__FILE__) + "/deep_test/rspec_detector"
|
|
23
58
|
require File.dirname(__FILE__) + "/deep_test/server"
|
|
24
59
|
require File.dirname(__FILE__) + "/deep_test/test_task"
|
|
25
60
|
require File.dirname(__FILE__) + "/deep_test/worker"
|
|
26
61
|
require File.dirname(__FILE__) + "/deep_test/warlock"
|
|
27
62
|
|
|
63
|
+
require File.dirname(__FILE__) + "/deep_test/database/setup_listener"
|
|
64
|
+
require File.dirname(__FILE__) + "/deep_test/database/mysql_setup_listener"
|
|
65
|
+
|
|
66
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/dispatch_controller"
|
|
67
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/drb_client_connection_info"
|
|
68
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/filename_resolver"
|
|
69
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/master_test_server"
|
|
70
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/test_server"
|
|
71
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/test_server_status"
|
|
72
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/test_server_workers"
|
|
73
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/multi_test_server_proxy"
|
|
74
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/null_work_unit"
|
|
75
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/remote_worker_client"
|
|
76
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/remote_worker_server"
|
|
77
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/rsync"
|
|
78
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/throughput_runner"
|
|
79
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/throughput_statistics"
|
|
80
|
+
require File.dirname(__FILE__) + "/deep_test/distributed/throughput_worker_client"
|
|
81
|
+
|
|
82
|
+
require File.dirname(__FILE__) + "/deep_test/metrics/gatherer"
|
|
83
|
+
|
|
28
84
|
DeepTest::RSpecDetector.if_rspec_available do
|
|
29
85
|
require File.dirname(__FILE__) + "/deep_test/spec"
|
|
30
86
|
end
|
|
31
87
|
require File.dirname(__FILE__) + "/deep_test/test"
|
|
32
88
|
|
|
89
|
+
require File.dirname(__FILE__) + "/deep_test/ui/console"
|
|
90
|
+
require File.dirname(__FILE__) + "/deep_test/ui/null"
|