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
@@ -12,9 +12,9 @@ module DeepTest
|
|
12
12
|
@options = options
|
13
13
|
end
|
14
14
|
|
15
|
-
def process_work_units
|
15
|
+
def process_work_units
|
16
16
|
suite = ::Test::Unit::AutoRunner::COLLECTORS[:objectspace].call NO_FILTERS
|
17
|
-
supervised_suite = DeepTest::Test::SupervisedTestSuite.new(suite,
|
17
|
+
supervised_suite = DeepTest::Test::SupervisedTestSuite.new(suite, @options.server)
|
18
18
|
require 'test/unit/ui/console/testrunner'
|
19
19
|
result = ::Test::Unit::UI::Console::TestRunner.run(supervised_suite, ::Test::Unit::UI::NORMAL)
|
20
20
|
result.passed?
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module DeepTest
|
2
2
|
module Test
|
3
3
|
class SupervisedTestSuite
|
4
|
-
def initialize(suite,
|
4
|
+
def initialize(suite, blackboard)
|
5
5
|
@suite = suite
|
6
|
-
@
|
6
|
+
@blackboard = blackboard
|
7
7
|
end
|
8
8
|
|
9
9
|
def run(result, &progress_block)
|
@@ -25,23 +25,24 @@ module DeepTest
|
|
25
25
|
end
|
26
26
|
else
|
27
27
|
tests_by_name[test_suite.name] = test_suite
|
28
|
-
@
|
28
|
+
@blackboard.write_work Test::WorkUnit.new(test_suite)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
def read_results(result, tests_by_name)
|
33
|
-
DeepTest.logger.debug
|
34
|
-
|
35
|
-
|
33
|
+
DeepTest.logger.debug("SupervisedTestSuite: going to read #{tests_by_name.size} results")
|
34
|
+
|
35
|
+
missing_tests =
|
36
|
+
ResultReader.new(@blackboard).read(tests_by_name) do |test, remote_result|
|
36
37
|
remote_result.add_to result
|
37
38
|
yield ::Test::Unit::TestCase::FINISHED, test.name if block_given?
|
38
39
|
end
|
39
40
|
|
40
|
-
|
41
|
-
result.add_error ::Test::Unit::Error.new(
|
41
|
+
missing_tests.each do |name, test_case|
|
42
|
+
result.add_error ::Test::Unit::Error.new(name, WorkUnitNeverReceivedError.new)
|
42
43
|
end
|
43
44
|
ensure
|
44
|
-
DeepTest.logger.debug
|
45
|
+
DeepTest.logger.debug("SupervisedTestSuite: exiting with #{missing_tests.size} results left")
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
data/lib/deep_test/test_task.rb
CHANGED
data/lib/deep_test/ui/console.rb
CHANGED
@@ -5,18 +5,20 @@ module DeepTest
|
|
5
5
|
end
|
6
6
|
|
7
7
|
METHOD_DESCRIPTIONS = {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:load_files => "Loading test files for
|
11
|
-
:
|
8
|
+
:sync => "Synchronizing working copies on worker machines",
|
9
|
+
:spawn_worker_server => "Spawning test environment processes",
|
10
|
+
:load_files => "Loading test files for workers",
|
11
|
+
:start_all => "Starting workers",
|
12
|
+
:stop_all => "Stopping workers"
|
12
13
|
} unless defined?(METHOD_DESCRIPTIONS)
|
13
14
|
|
14
15
|
def distributed_failover_to_local(method, exception)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
width = 70
|
17
|
+
puts " Distributed DeepTest Failure ".center(width, '*')
|
18
|
+
puts "* Failed during #{method}".ljust(width - 1) + "*"
|
19
|
+
puts "* #{exception.message}".ljust(width - 1) + "*"
|
20
|
+
puts "* Failing over to local run".ljust(width - 1) + "*"
|
21
|
+
puts "*" * width
|
20
22
|
end
|
21
23
|
|
22
24
|
def dispatch_starting(method_name)
|
data/lib/deep_test/warlock.rb
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
module DeepTest
|
2
2
|
class Warlock
|
3
|
-
def initialize
|
4
|
-
@options = options
|
3
|
+
def initialize
|
5
4
|
@demons_semaphore = Mutex.new
|
6
5
|
@demons = []
|
7
6
|
@reapers = []
|
8
7
|
end
|
9
8
|
|
10
|
-
def start(name,
|
9
|
+
def start(name, &block)
|
11
10
|
# Not synchronizing for the fork seems to cause
|
12
11
|
# random errors (Bus Error, Segfault, and GC non-object)
|
13
|
-
# in
|
12
|
+
# in RemoteWorkerServer processes.
|
14
13
|
#
|
15
14
|
begin
|
16
15
|
pid = nil
|
17
16
|
@demons_semaphore.synchronize do
|
18
|
-
pid =
|
17
|
+
pid = DeepTest.drb_safe_fork do
|
19
18
|
# Fork leaves the semaphore locked and we'll never make it
|
20
19
|
# to end of synchronize block.
|
21
20
|
#
|
@@ -25,8 +24,12 @@ module DeepTest
|
|
25
24
|
#
|
26
25
|
@demons_semaphore.unlock if @demons_semaphore.locked?
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
begin
|
28
|
+
yield
|
29
|
+
rescue Exception => e
|
30
|
+
DeepTest.logger.debug "Exception in #{name} (#{Process.pid}): #{e.message}"
|
31
|
+
raise
|
32
|
+
end
|
30
33
|
|
31
34
|
exit
|
32
35
|
end
|
@@ -43,23 +46,14 @@ module DeepTest
|
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
46
|
-
def close_open_network_connections
|
47
|
-
ObjectSpace.each_object(BasicSocket) do |sock|
|
48
|
-
begin
|
49
|
-
sock.close
|
50
|
-
rescue IOError
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
49
|
def demon_count
|
56
50
|
@demons_semaphore.synchronize do
|
57
51
|
@demons.size
|
58
52
|
end
|
59
53
|
end
|
60
54
|
|
61
|
-
def
|
62
|
-
DeepTest.logger.debug
|
55
|
+
def stop_all
|
56
|
+
DeepTest.logger.debug("stopping all demons")
|
63
57
|
receivers = @demons_semaphore.synchronize do
|
64
58
|
@demons.reverse
|
65
59
|
end
|
@@ -67,31 +61,25 @@ module DeepTest
|
|
67
61
|
receivers.reverse.each do |demon|
|
68
62
|
name, pid = demon
|
69
63
|
if running?(pid)
|
70
|
-
DeepTest.logger.debug
|
64
|
+
DeepTest.logger.debug("Sending SIGTERM to #{name}, #{pid}")
|
71
65
|
Process.kill("TERM", pid)
|
72
66
|
end
|
73
67
|
end
|
74
|
-
DeepTest.logger.debug
|
68
|
+
DeepTest.logger.debug("Warlock: Stopped all receivers")
|
75
69
|
|
76
|
-
DeepTest.logger.debug
|
70
|
+
DeepTest.logger.debug("waiting for reapers")
|
77
71
|
@reapers.each {|r| r.join}
|
78
72
|
|
79
|
-
DeepTest.logger.debug
|
73
|
+
DeepTest.logger.debug("Warlock: done reaping processes")
|
80
74
|
end
|
81
75
|
|
82
76
|
def exit_when_none_running
|
83
77
|
Thread.new do
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
def wait_for_all_to_finish
|
91
|
-
loop do
|
92
|
-
Thread.pass
|
93
|
-
return unless any_running?
|
94
|
-
sleep(0.01)
|
78
|
+
loop do
|
79
|
+
Thread.pass
|
80
|
+
exit(0) unless any_running?
|
81
|
+
sleep(0.01)
|
82
|
+
end
|
95
83
|
end
|
96
84
|
end
|
97
85
|
|
@@ -122,22 +110,22 @@ module DeepTest
|
|
122
110
|
protected
|
123
111
|
|
124
112
|
def add_demon(name, pid)
|
125
|
-
DeepTest.logger.debug
|
113
|
+
DeepTest.logger.debug "Started: #{name} (#{pid})"
|
126
114
|
@demons << [name, pid]
|
127
115
|
end
|
128
116
|
|
129
117
|
def remove_demon(name, pid)
|
130
118
|
@demons.delete [name, pid]
|
131
|
-
DeepTest.logger.debug
|
119
|
+
DeepTest.logger.debug "Stopped: #{name} (#{pid})"
|
132
120
|
end
|
133
121
|
|
134
122
|
|
135
123
|
def launch_reaper_thread(name, pid)
|
136
124
|
@reapers << Thread.new do
|
137
125
|
Process.detach(pid).join
|
138
|
-
DeepTest.logger.debug
|
126
|
+
DeepTest.logger.debug("#{name} (#{pid}) reaped")
|
139
127
|
@demons_semaphore.synchronize do
|
140
|
-
DeepTest.logger.debug
|
128
|
+
DeepTest.logger.debug("Warlock Reaper: removing #{name} (#{pid}) from demon list")
|
141
129
|
remove_demon name, pid
|
142
130
|
end
|
143
131
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module DeepTest
|
2
|
+
class Worker
|
3
|
+
attr_reader :number
|
4
|
+
|
5
|
+
def initialize(number, blackboard, worker_listener)
|
6
|
+
@number = number
|
7
|
+
@blackboard = blackboard
|
8
|
+
@listener = worker_listener
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
@listener.starting(self)
|
13
|
+
while work_unit = next_work_unit
|
14
|
+
@listener.starting_work(self, work_unit)
|
15
|
+
|
16
|
+
result = begin
|
17
|
+
work_unit.run
|
18
|
+
rescue Exception => error
|
19
|
+
Error.new(work_unit, error)
|
20
|
+
end
|
21
|
+
|
22
|
+
@listener.finished_work(self, work_unit, result)
|
23
|
+
@blackboard.write_result result
|
24
|
+
if ENV['DEEP_TEST_SHOW_WORKER_DOTS'] == 'yes'
|
25
|
+
$stdout.print '.'
|
26
|
+
$stdout.flush
|
27
|
+
end
|
28
|
+
end
|
29
|
+
rescue Server::NoWorkUnitsRemainingError
|
30
|
+
DeepTest.logger.debug("Worker #{number}: no more work to do")
|
31
|
+
end
|
32
|
+
|
33
|
+
def next_work_unit
|
34
|
+
@blackboard.take_work
|
35
|
+
rescue Server::NoWorkUnitsAvailableError
|
36
|
+
sleep 0.02
|
37
|
+
retry
|
38
|
+
end
|
39
|
+
|
40
|
+
class Error
|
41
|
+
attr_accessor :work_unit, :error
|
42
|
+
|
43
|
+
def initialize(work_unit, error)
|
44
|
+
@work_unit, @error = work_unit, error
|
45
|
+
end
|
46
|
+
|
47
|
+
def ==(other)
|
48
|
+
work_unit == other.work_unit &&
|
49
|
+
error == other.error
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_s
|
53
|
+
"#{@work_unit}: #{@error}\n" + (@error.backtrace || []).join("\n")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class ForeignHostAgentSimulationListener < DeepTest::NullListener
|
4
|
-
def starting(agent)
|
1
|
+
class ForeignHostWorkerSimulationListener < DeepTest::NullWorkerListener
|
2
|
+
def starting(worker)
|
5
3
|
# On a foreign host, there won't necessarily be a database for tests
|
6
4
|
# to run against. We simulate that by dropping them here.
|
7
5
|
#
|
8
|
-
# It's important that this happens as the first thing when the
|
6
|
+
# It's important that this happens as the first thing when the workers
|
9
7
|
# are started, since this is the first listener event that would be
|
10
|
-
# invoked on a foreign host.
|
8
|
+
# invoked on a foreign host. before_starting_workers would be invoked
|
11
9
|
# on the local host, which should have databases available as usual.
|
12
10
|
#
|
13
11
|
system "mysqladmin -u root -f drop sample_rails_project_development > /dev/null"
|
@@ -1,27 +1,18 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
gem 'rspec', '=1.1.8'
|
3
3
|
require 'spec/rake/spectask'
|
4
|
-
$LOAD_PATH << File.dirname(__FILE__) + "
|
4
|
+
$LOAD_PATH << File.dirname(__FILE__) + "/../../../lib"
|
5
5
|
require 'deep_test/rake_tasks'
|
6
6
|
|
7
7
|
DeepTest::TestTask.new(:deep_test) do |t|
|
8
|
-
t.
|
8
|
+
t.number_of_workers = 1
|
9
9
|
t.pattern = "test/unit/**/*_test.rb"
|
10
|
-
t.
|
10
|
+
t.worker_listener = "ForeignHostWorkerSimulationListener,DeepTest::Database::MysqlSetupListener"
|
11
11
|
end
|
12
12
|
Rake::Task[:deep_test].enhance ["db:test:prepare"]
|
13
13
|
|
14
14
|
Spec::Rake::SpecTask.new(:deep_spec) do |t|
|
15
15
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
16
|
-
t.deep_test :
|
16
|
+
t.deep_test :number_of_workers => 2
|
17
17
|
end
|
18
18
|
Rake::Task[:deep_spec].enhance ["db:test:prepare"]
|
19
|
-
|
20
|
-
DeepTest::TestTask.new(:distributed_test => %w[db:test:prepare]) do |t|
|
21
|
-
t.number_of_agents = 1
|
22
|
-
t.distributed_hosts = %w[localhost]
|
23
|
-
t.requires = File.dirname(__FILE__) + "/../foreign_host_agent_simulation_listener"
|
24
|
-
t.listener = "ForeignHostAgentSimulationListener,DeepTest::Database::MysqlSetupListener"
|
25
|
-
t.sync_options = {:source => File.expand_path(File.dirname(__FILE__) + "/../.."),
|
26
|
-
:rsync_options => "--exclude=.svn --copy-dirlinks"}
|
27
|
-
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/deep_test"
|
2
|
+
options = DeepTest::Options.from_command_line(ARGV[0])
|
3
|
+
DeepTest.init(options)
|
4
|
+
runner = DeepTest::Test::Runner.new(options)
|
5
|
+
workers = options.new_workers
|
6
|
+
workers.load_files Dir.glob(options.pattern)
|
7
|
+
DeepTest::ProcessOrchestrator.run(options, workers, runner)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/deep_test"
|
2
|
+
require 'drb/drb'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
uri = "drubyall://:4021"
|
6
|
+
slave_uris = OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage: deep_test master_test_server [options] <test_server_uris>"
|
8
|
+
|
9
|
+
opts.on("--uri URI", "DRb URI to bind server to") do |v|
|
10
|
+
uri = v
|
11
|
+
end
|
12
|
+
|
13
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
14
|
+
puts opts
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
end.parse(ARGV)
|
18
|
+
|
19
|
+
begin
|
20
|
+
DeepTest::Distributed::MasterTestServer.start(uri, slave_uris)
|
21
|
+
rescue Interrupt
|
22
|
+
DeepTest.logger.info "Exiting due to Interrupt"
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../../lib/deep_test"
|
2
|
+
require 'drb/drb'
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
config = DeepTest::Distributed::TestServer.parse_args(ARGV)
|
6
|
+
|
7
|
+
#
|
8
|
+
# Clear args so they won't be processed in any forked processes.
|
9
|
+
# - When specs are loaded by the RemoteWorkerServer, RSpec
|
10
|
+
# attempts to parse ARGV
|
11
|
+
#
|
12
|
+
ARGV.clear
|
13
|
+
|
14
|
+
begin
|
15
|
+
DeepTest::Distributed::TestServer.start(config)
|
16
|
+
rescue Interrupt
|
17
|
+
DeepTest.logger.info "Exiting due to Interrupt"
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../lib/deep_test'
|
2
|
+
|
3
|
+
unless ARGV.length == 2
|
4
|
+
puts "Usage: deep_test test_throughput <server uri> <test_count>"
|
5
|
+
exit(1)
|
6
|
+
end
|
7
|
+
|
8
|
+
uri = ARGV[0]
|
9
|
+
test_count = ARGV[1].to_i
|
10
|
+
|
11
|
+
options = DeepTest::Options.new(:distributed_server => uri,
|
12
|
+
:sync_options => {:source => ""})
|
13
|
+
server = DeepTest::Distributed::TestServer.connect options
|
14
|
+
workers = DeepTest::Distributed::ThroughputWorkerClient.new(options, server)
|
15
|
+
runner = DeepTest::Distributed::ThroughputRunner.new(options, test_count) do |result|
|
16
|
+
$stdout.print "."
|
17
|
+
$stdout.flush
|
18
|
+
end
|
19
|
+
|
20
|
+
start_time = Time.now
|
21
|
+
DeepTest::ProcessOrchestrator.new(options, workers, runner).run(false)
|
22
|
+
end_time = Time.now
|
23
|
+
|
24
|
+
puts
|
25
|
+
puts runner.statistics.summary
|
26
|
+
|
27
|
+
run_time = end_time.to_f - start_time.to_f
|
28
|
+
puts "Total Run Time: #{run_time} seconds"
|
29
|
+
puts "Run Time Not Spent On Tests: #{run_time - runner.statistics.timespan_in_seconds}"
|