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
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../spec_helper"
|
2
|
+
|
3
|
+
module DeepTest
|
4
|
+
describe Option do
|
5
|
+
it "should have hash conversion" do
|
6
|
+
option = Option.new(:name, Option::Hash, {})
|
7
|
+
string = option.to_command_line({:a => "1", :b => "a"})
|
8
|
+
string.should be_instance_of(String)
|
9
|
+
option.from_command_line(string).should == {:a => "1", :b => "a"}
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should support booleans in hash" do
|
13
|
+
option = Option.new(:name, Option::Hash, {})
|
14
|
+
string = option.to_command_line({:a => true})
|
15
|
+
string.should be_instance_of(String)
|
16
|
+
option.from_command_line(string).should == {:a => true}
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should handle hash values with spaces" do
|
20
|
+
option = Option.new(:name, Option::Hash, {})
|
21
|
+
|
22
|
+
string = option.to_command_line(
|
23
|
+
{:a => "has a space", :b => "has more spaces"}
|
24
|
+
)
|
25
|
+
|
26
|
+
string.should be_instance_of(String)
|
27
|
+
|
28
|
+
option.from_command_line(string).should ==
|
29
|
+
{:a => "has a space", :b => "has more spaces"}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -2,55 +2,59 @@ require File.dirname(__FILE__) + "/../spec_helper"
|
|
2
2
|
|
3
3
|
module DeepTest
|
4
4
|
describe Options do
|
5
|
-
it "should support
|
6
|
-
Options.new(:
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should default to number_of_agents based on cpu info at time of call" do
|
10
|
-
options = Options.new({})
|
11
|
-
CpuInfo.should_receive(:new).and_return stub("cpu_info", :count => 4)
|
12
|
-
options.number_of_agents.should == 4
|
5
|
+
it "should support number_of_workers" do
|
6
|
+
Options.new(:number_of_workers => 3).number_of_workers.should == 3
|
13
7
|
end
|
14
8
|
|
15
9
|
it "should have reasonable defaults" do
|
16
10
|
options = Options.new({})
|
11
|
+
options.number_of_workers.should == 2
|
12
|
+
options.timeout_in_seconds.should == 30
|
13
|
+
options.server_port.should == 6969
|
17
14
|
options.pattern.should == nil
|
18
15
|
options.metrics_file.should == nil
|
19
16
|
end
|
20
17
|
|
18
|
+
it "should support timeout_in_seconds" do
|
19
|
+
Options.new(:timeout_in_seconds => 2).timeout_in_seconds.should == 2
|
20
|
+
end
|
21
|
+
|
21
22
|
it "should support pattern" do
|
22
23
|
Options.new(:pattern => '*').pattern.should == '*'
|
23
24
|
end
|
24
25
|
|
25
|
-
it "should support
|
26
|
-
Options.new(:
|
27
|
-
|
26
|
+
it "should support distributed_server" do
|
27
|
+
Options.new(:distributed_server => "uri").distributed_server.should == "uri"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should support server_port" do
|
31
|
+
Options.new(:server_port => 10).server_port.should == 10
|
28
32
|
end
|
29
33
|
|
30
34
|
it "should support sync_options" do
|
31
35
|
Options.new(:sync_options => {:options => 1}).sync_options.should == {:options => 1}
|
32
36
|
end
|
33
37
|
|
34
|
-
it "should support
|
35
|
-
Options.new(:
|
36
|
-
|
38
|
+
it "should support worker_listener" do
|
39
|
+
Options.new(:worker_listener => "AListener").
|
40
|
+
worker_listener.should == "AListener"
|
37
41
|
end
|
38
42
|
|
39
|
-
it "should use DeepTest::
|
40
|
-
Options.new({}).
|
43
|
+
it "should use DeepTest::NullWorkerListener as the default listener" do
|
44
|
+
Options.new({}).worker_listener.should == "DeepTest::NullWorkerListener"
|
41
45
|
end
|
42
46
|
|
43
|
-
it "should allow
|
47
|
+
it "should allow worker_listener to be set with class" do
|
44
48
|
class FakeListener; end
|
45
|
-
Options.new(:
|
46
|
-
|
49
|
+
Options.new(:worker_listener => FakeListener).
|
50
|
+
worker_listener.should == "DeepTest::FakeListener"
|
47
51
|
end
|
48
52
|
|
49
|
-
it "should allow multiple
|
53
|
+
it "should allow multiple workers to be specified" do
|
50
54
|
class FakeListener1; end
|
51
55
|
class FakeListener2; end
|
52
56
|
options = Options.new(
|
53
|
-
:
|
57
|
+
:worker_listener => "DeepTest::FakeListener1,DeepTest::FakeListener2"
|
54
58
|
)
|
55
59
|
listener = options.new_listener_list
|
56
60
|
listener.should be_instance_of(DeepTest::ListenerList)
|
@@ -59,7 +63,7 @@ module DeepTest
|
|
59
63
|
listener.listeners.last.should be_instance_of(FakeListener2)
|
60
64
|
end
|
61
65
|
|
62
|
-
it "should create a list of
|
66
|
+
it "should create a list of worker listeners upon request" do
|
63
67
|
Options.new({}).new_listener_list.should be_instance_of(DeepTest::ListenerList)
|
64
68
|
end
|
65
69
|
|
@@ -88,7 +92,7 @@ module DeepTest
|
|
88
92
|
end
|
89
93
|
|
90
94
|
it "should support strings as well as symbols" do
|
91
|
-
Options.new("
|
95
|
+
Options.new("number_of_workers" => 2).number_of_workers.should == 2
|
92
96
|
end
|
93
97
|
|
94
98
|
it "should raise error when invalid option is specifed" do
|
@@ -98,50 +102,42 @@ module DeepTest
|
|
98
102
|
end
|
99
103
|
|
100
104
|
it "should convert to command line option string" do
|
101
|
-
options = Options.new(:
|
102
|
-
options.to_command_line.should ==
|
105
|
+
options = Options.new(:number_of_workers => 1, :timeout_in_seconds => 3)
|
106
|
+
options.to_command_line.should ==
|
107
|
+
"--number_of_workers 1 --timeout_in_seconds 3"
|
103
108
|
end
|
104
109
|
|
105
110
|
it "should parse from command line option string" do
|
106
|
-
options = Options.
|
107
|
-
|
108
|
-
|
109
|
-
|
111
|
+
options = Options.from_command_line(
|
112
|
+
"--number_of_workers 2 --timeout_in_seconds 3 --pattern *")
|
113
|
+
options.number_of_workers.should == 2
|
114
|
+
options.timeout_in_seconds.should == 3
|
115
|
+
options.pattern.should == '*'
|
110
116
|
end
|
111
117
|
|
112
118
|
it "should use default option value when no command line option is present" do
|
113
|
-
|
114
|
-
|
115
|
-
options.ui == "DeepTest::UI::Console"
|
116
|
-
end
|
119
|
+
options = Options.from_command_line("")
|
120
|
+
options.number_of_workers.should == 2
|
117
121
|
end
|
118
122
|
|
119
|
-
it "should create local
|
123
|
+
it "should create local workers by default" do
|
120
124
|
options = Options.new({})
|
121
|
-
options.
|
125
|
+
options.new_workers.should be_instance_of(LocalWorkers)
|
122
126
|
end
|
123
127
|
|
124
|
-
it "should create remote
|
125
|
-
options = Options.new(:
|
126
|
-
Distributed::
|
127
|
-
|
128
|
-
|
129
|
-
options.new_deployment
|
128
|
+
it "should create remote worker client when distributed server is specified" do
|
129
|
+
options = Options.new(:distributed_server => "uri", :sync_options => {:source => "root"})
|
130
|
+
Distributed::TestServer.should_receive(:connect).with(options).and_return(:server_instance)
|
131
|
+
Distributed::RemoteWorkerClient.should_receive(:new).with(options, :server_instance, be_instance_of(LocalWorkers))
|
132
|
+
options.new_workers
|
130
133
|
end
|
131
134
|
|
132
|
-
it "should create
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
:distributed_hosts => %w[host1 host2])
|
137
|
-
|
138
|
-
Distributed::RSync.should_receive(:push).with("host1", options.sync_options, "/tmp/myhost_my_local_dir")
|
139
|
-
Distributed::RSync.should_receive(:push).with("host2", options.sync_options, "/tmp/myhost_my_local_dir")
|
140
|
-
|
141
|
-
options.new_landing_fleet.push_code(options)
|
135
|
+
it "should create local workers when connect fails" do
|
136
|
+
options = Options.new(:distributed_server => "uri", :sync_options => {:source => "root"}, :ui => "DeepTest::UI::Null")
|
137
|
+
Distributed::TestServer.should_receive(:connect).and_raise("An error")
|
138
|
+
options.new_workers.should be_instance_of(LocalWorkers)
|
142
139
|
end
|
143
140
|
|
144
|
-
|
145
141
|
it "should return localhost as origin_hostname current hostname is same as when created" do
|
146
142
|
options = Options.new({})
|
147
143
|
options.origin_hostname.should == 'localhost'
|
@@ -154,41 +150,24 @@ module DeepTest
|
|
154
150
|
options.origin_hostname.should == local_hostname
|
155
151
|
end
|
156
152
|
|
157
|
-
it "should
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
end
|
163
|
-
|
164
|
-
it "should connect_to_central_command on remote address where there is SSH info" do
|
165
|
-
Telegraph::Wire.should_receive(:connect).with("remote_address", 9999).and_yield(:wire)
|
166
|
-
yielded_wire = nil
|
167
|
-
|
168
|
-
options = Options.new(:server_port => 9999)
|
169
|
-
options.ssh_client_connection_info = mock("connection_info", :address => "remote_address")
|
170
|
-
options.connect_to_central_command { |yielded_wire| }
|
171
|
-
|
172
|
-
yielded_wire.should == :wire
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should be able to calculate mirror_path based on sync_options" do
|
176
|
-
Socket.should_receive(:gethostname).and_return("hostname")
|
177
|
-
options = Options.new(:sync_options => {:source => "/my/source/path", :remote_base_dir => "/mirror/base/path"})
|
178
|
-
options.mirror_path.should == "/mirror/base/path/hostname_my_source_path"
|
153
|
+
it "should be able to calculate mirror_path based on base an sync_options" do
|
154
|
+
Socket.should_receive(:gethostname).and_return("hostname", "server_hostname")
|
155
|
+
options = Options.new(:sync_options => {:source => "/my/source/path"})
|
156
|
+
options.mirror_path("/mirror/base/path").should ==
|
157
|
+
"/mirror/base/path/hostname_my_source_path"
|
179
158
|
end
|
180
159
|
|
181
160
|
it "should raise a useful error if no source is specified" do
|
182
|
-
options = DeepTest::Options.new(:sync_options => {
|
161
|
+
options = DeepTest::Options.new(:sync_options => {})
|
183
162
|
lambda {
|
184
|
-
options.mirror_path
|
163
|
+
options.mirror_path("base")
|
185
164
|
}.should raise_error("No source directory specified in sync_options")
|
186
165
|
end
|
187
166
|
|
188
|
-
it "should
|
189
|
-
|
190
|
-
|
191
|
-
|
167
|
+
it "should create drb object to connect to server" do
|
168
|
+
options = DeepTest::Options.new({})
|
169
|
+
server = options.server
|
170
|
+
server.__drburi.should == "druby://#{options.origin_hostname}:#{options.server_port}"
|
192
171
|
end
|
193
172
|
|
194
173
|
it "should be gathering metrics if metrics file is set" do
|
@@ -14,9 +14,8 @@ module Spec
|
|
14
14
|
example_1 = group.examples.first
|
15
15
|
example_2 = group.examples.last
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
(example_2.identifier.locate([group]) == example_2).should == true
|
17
|
+
example_1.identifier.locate([group]).should == example_1
|
18
|
+
example_2.identifier.locate([group]).should == example_2
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should have identifier that can locate the example by name" do
|
@@ -29,8 +28,8 @@ module Spec
|
|
29
28
|
example_1 = group.examples.first
|
30
29
|
example_2 = group.examples.last
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
example_1.identifier.locate([group]).should == example_1
|
32
|
+
example_2.identifier.locate([group]).should == example_2
|
34
33
|
end
|
35
34
|
|
36
35
|
describe ExampleMethods::Identifier do
|
@@ -3,11 +3,12 @@ require File.dirname(__FILE__) + "/../../../spec_helper"
|
|
3
3
|
describe Spec::Rake::SpecTask do
|
4
4
|
it "should allow deep_test configuration" do
|
5
5
|
t = Spec::Rake::SpecTask.new do |t|
|
6
|
-
t.deep_test :
|
6
|
+
t.deep_test :number_of_workers => 2
|
7
7
|
end
|
8
8
|
|
9
|
-
deep_test_path = File.expand_path(
|
10
|
-
|
9
|
+
deep_test_path = File.expand_path(File.dirname(__FILE__) +
|
10
|
+
'/../../../../lib/deep_test')
|
11
|
+
options = DeepTest::Options.new(:number_of_workers => 2)
|
11
12
|
t.spec_opts.should == ["--require #{deep_test_path}",
|
12
13
|
"--runner 'DeepTest::Spec::Runner:#{options.to_command_line}'"]
|
13
14
|
end
|
@@ -18,7 +19,8 @@ describe Spec::Rake::SpecTask do
|
|
18
19
|
t.spec_opts = ["anoption"]
|
19
20
|
end
|
20
21
|
|
21
|
-
deep_test_path = File.expand_path(
|
22
|
+
deep_test_path = File.expand_path(File.dirname(__FILE__) +
|
23
|
+
'/../../../../lib/deep_test')
|
22
24
|
options = DeepTest::Options.new({})
|
23
25
|
t.spec_opts.should == ["--require #{deep_test_path}",
|
24
26
|
"--runner 'DeepTest::Spec::Runner:#{options.to_command_line}'",
|
@@ -5,127 +5,100 @@ module DeepTest
|
|
5
5
|
describe Runner do
|
6
6
|
it_should_behave_like 'sandboxed rspec_options'
|
7
7
|
|
8
|
-
it "should run each test using
|
9
|
-
|
10
|
-
|
11
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
8
|
+
it "should run each test using blackboard" do
|
9
|
+
blackboard = SimpleTestBlackboard.new
|
10
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
12
11
|
|
13
12
|
describe("test") do
|
14
13
|
it("passes1") {}
|
15
14
|
it("passes2") {}
|
16
15
|
end
|
17
16
|
|
18
|
-
|
17
|
+
worker = ThreadWorker.new(blackboard, 2)
|
19
18
|
Timeout.timeout(5) do
|
20
|
-
runner.process_work_units
|
19
|
+
runner.process_work_units.should == true
|
21
20
|
end
|
22
|
-
|
23
|
-
agent.wait_until_done
|
21
|
+
worker.wait_until_done
|
24
22
|
|
25
|
-
|
23
|
+
worker.work_done.should == 2
|
26
24
|
options.reporter.number_of_examples.should == 2
|
27
|
-
|
25
|
+
blackboard.take_result.should be_nil
|
28
26
|
options.reporter.examples_finished.should == ['passes1','passes2']
|
29
27
|
options.reporter.should be_ended
|
30
28
|
end
|
31
29
|
|
32
30
|
it "should return failure when a spec fails" do
|
33
|
-
|
34
|
-
|
35
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
31
|
+
blackboard = SimpleTestBlackboard.new
|
32
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
36
33
|
|
37
34
|
describe("test") do
|
38
35
|
it("passes") {};
|
39
36
|
it("fails") {1.should == 2};
|
40
37
|
end
|
41
38
|
|
42
|
-
|
39
|
+
worker = ThreadWorker.new(blackboard, 2)
|
43
40
|
Timeout.timeout(5) do
|
44
|
-
runner.process_work_units
|
41
|
+
runner.process_work_units.should == false
|
45
42
|
end
|
46
|
-
|
47
|
-
agent.wait_until_done
|
43
|
+
worker.wait_until_done
|
48
44
|
end
|
49
45
|
|
50
46
|
it "should return success when there are pending examples" do
|
51
|
-
|
52
|
-
|
53
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
47
|
+
blackboard = SimpleTestBlackboard.new
|
48
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
54
49
|
|
55
50
|
describe("test") do
|
56
51
|
it("pending") {pending {1.should == 2}};
|
57
52
|
end
|
58
53
|
|
59
|
-
|
54
|
+
worker = ThreadWorker.new(blackboard, 1)
|
60
55
|
Timeout.timeout(5) do
|
61
|
-
runner.process_work_units
|
56
|
+
runner.process_work_units.should == true
|
62
57
|
end
|
63
|
-
|
64
|
-
agent.wait_until_done
|
58
|
+
worker.wait_until_done
|
65
59
|
end
|
66
60
|
|
67
61
|
it "should return failure when a pending example passes" do
|
68
|
-
|
69
|
-
|
70
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
62
|
+
blackboard = SimpleTestBlackboard.new
|
63
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
71
64
|
|
72
65
|
describe("test") do
|
73
66
|
it("pending") {pending {1.should == 1}};
|
74
67
|
end
|
75
68
|
|
76
|
-
|
69
|
+
worker = ThreadWorker.new(blackboard, 1)
|
77
70
|
Timeout.timeout(5) do
|
78
|
-
runner.process_work_units
|
71
|
+
runner.process_work_units.should == false
|
79
72
|
end
|
80
|
-
|
81
|
-
agent.wait_until_done
|
73
|
+
worker.wait_until_done
|
82
74
|
end
|
83
75
|
|
84
|
-
it "should return failure when a
|
85
|
-
|
86
|
-
|
87
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
88
|
-
|
89
|
-
describe("test") { it("does") {} }
|
90
|
-
|
91
|
-
central_command.write_result Agent::Error.new("example", RuntimeError.new)
|
92
|
-
capture_stdout do
|
93
|
-
runner.process_work_units(central_command).should == false
|
94
|
-
end
|
95
|
-
|
96
|
-
options.reporter.number_of_errors.should == 1
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should return a singl efailure when multiple agent error occurs" do
|
100
|
-
deep_test_options = Options.new({})
|
101
|
-
central_command = TestCentralCommand.start deep_test_options
|
102
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
76
|
+
it "should return failure when a worker error occurs" do
|
77
|
+
blackboard = SimpleTestBlackboard.new
|
78
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
103
79
|
|
104
80
|
describe("test") do
|
105
|
-
it("
|
106
|
-
it("does b") {}
|
81
|
+
it("pending") {pending {1.should == 1}};
|
107
82
|
end
|
108
83
|
|
109
|
-
|
110
|
-
central_command.write_result Agent::Error.new("example 2", RuntimeError.new)
|
84
|
+
blackboard.write_result Worker::Error.new("example", RuntimeError.new)
|
111
85
|
capture_stdout do
|
112
|
-
runner.process_work_units
|
86
|
+
runner.process_work_units.should == false
|
113
87
|
end
|
114
88
|
|
115
89
|
options.reporter.number_of_errors.should == 1
|
116
90
|
end
|
117
91
|
|
118
92
|
it "should raise error if duplicate spec is found" do
|
119
|
-
|
120
|
-
|
121
|
-
runner = Runner.new(options, deep_test_options.to_command_line)
|
93
|
+
blackboard = SimpleTestBlackboard.new
|
94
|
+
runner = Runner.new(options, Options.new({}), blackboard)
|
122
95
|
|
123
96
|
describe("test") do
|
124
97
|
2.times {it("example") {}};
|
125
98
|
end
|
126
99
|
|
127
100
|
lambda {
|
128
|
-
runner.process_work_units
|
101
|
+
runner.process_work_units
|
129
102
|
}.should raise_error
|
130
103
|
end
|
131
104
|
end
|