jstorimer-deep-test 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +41 -70
- data/Rakefile +47 -119
- data/TODO +2 -2
- data/VERSION +1 -1
- data/infrastructure/dynamic_teardown.rb +22 -0
- data/{test → infrastructure}/fake_deadlock_error.rb +0 -0
- data/infrastructure/load.rb +11 -0
- data/infrastructure/test_central_command.rb +15 -0
- data/infrastructure/test_exception.rb +7 -0
- data/{test → infrastructure}/test_factory.rb +0 -0
- data/infrastructure/test_logger.rb +11 -0
- data/infrastructure/test_operator.rb +15 -0
- data/infrastructure/test_result.rb +15 -0
- data/infrastructure/thread_agent.rb +21 -0
- data/infrastructure/timewarp/Rakefile +14 -0
- data/infrastructure/timewarp/lib/timewarp.rb +21 -0
- data/infrastructure/timewarp/test/timewarp_test.rb +45 -0
- data/lib/deep_test.rb +28 -40
- data/lib/deep_test/agent.rb +108 -0
- data/lib/deep_test/central_command.rb +165 -0
- data/lib/deep_test/cpu_info.rb +22 -0
- data/lib/deep_test/database/mysql_setup_listener.rb +11 -12
- data/lib/deep_test/database/setup_listener.rb +23 -23
- data/lib/deep_test/demon.rb +25 -0
- data/lib/deep_test/distributed/beachhead.rb +104 -0
- data/lib/deep_test/distributed/dispatch_controller.rb +17 -10
- data/lib/deep_test/distributed/establish_beachhead.rb +19 -0
- data/lib/deep_test/distributed/landing_fleet.rb +30 -0
- data/lib/deep_test/distributed/landing_ship.rb +60 -0
- data/lib/deep_test/distributed/remote_deployment.rb +56 -0
- data/lib/deep_test/distributed/rsync.rb +25 -12
- data/lib/deep_test/distributed/shell_environment.rb +50 -0
- data/lib/deep_test/distributed/ssh_client_connection_info.rb +14 -0
- data/lib/deep_test/failure_message.rb +19 -0
- data/lib/deep_test/lib_root.rb +4 -0
- data/lib/deep_test/listener_list.rb +1 -1
- data/lib/deep_test/local_deployment.rb +46 -0
- data/lib/deep_test/logger.rb +17 -2
- data/lib/deep_test/main.rb +41 -0
- data/lib/deep_test/marshallable_exception_wrapper.rb +4 -4
- data/lib/deep_test/metrics/data.rb +34 -0
- data/lib/deep_test/metrics/measurement.rb +39 -0
- data/lib/deep_test/{null_worker_listener.rb → null_listener.rb} +14 -14
- data/lib/deep_test/options.rb +41 -56
- data/lib/deep_test/proxy_io.rb +77 -0
- data/lib/deep_test/rake_tasks.rb +3 -1
- data/lib/deep_test/result_reader.rb +10 -6
- data/lib/deep_test/rspec_detector.rb +1 -1
- data/lib/deep_test/spec.rb +5 -1
- data/lib/deep_test/spec/extensions/example_methods.rb +7 -1
- data/lib/deep_test/spec/extensions/spec_task.rb +3 -2
- data/lib/deep_test/spec/runner.rb +32 -17
- data/lib/deep_test/spec/work_result.rb +2 -0
- data/lib/deep_test/test/run_test_suite.rb +5 -0
- data/lib/deep_test/test/runner.rb +2 -2
- data/lib/deep_test/test/supervised_test_suite.rb +9 -10
- data/lib/deep_test/test/work_result.rb +1 -0
- data/lib/deep_test/test_task.rb +1 -1
- data/lib/deep_test/ui/console.rb +9 -11
- data/lib/deep_test/warlock.rb +37 -25
- data/lib/telegraph.rb +29 -0
- data/lib/telegraph/ack_sequence.rb +14 -0
- data/lib/telegraph/logging.rb +20 -0
- data/lib/telegraph/message.rb +39 -0
- data/lib/telegraph/operator.rb +47 -0
- data/lib/telegraph/switchboard.rb +57 -0
- data/lib/telegraph/wire.rb +73 -0
- data/negative_acceptance_tests/dying_spec.rb +13 -0
- data/negative_acceptance_tests/dying_test.rb +13 -0
- data/negative_acceptance_tests/failing_spec.rb +9 -0
- data/{test/failing.rb → negative_acceptance_tests/failing_test.rb} +3 -1
- data/negative_acceptance_tests/kill_agent_one_on_start_work.rb +16 -0
- data/negative_acceptance_tests/passing_spec.rb +10 -0
- data/negative_acceptance_tests/passing_test.rb +12 -0
- data/negative_acceptance_tests/tasks.rake +87 -0
- data/negative_acceptance_tests/tests.rb +60 -0
- data/sample_rails_project/deep_test.rb +4 -0
- data/sample_rails_project/lib/{foreign_host_worker_simulation_listener.rb → foreign_host_agent_simulation_listener.rb} +6 -4
- data/sample_rails_project/lib/tasks/deep_test.rake +13 -4
- data/spec/deep_test/options_spec.rb +80 -59
- data/spec/deep_test/spec/extensions/example_methods_spec.rb +5 -4
- data/spec/deep_test/spec/extensions/spec_task_spec.rb +4 -6
- data/spec/deep_test/spec/runner_spec.rb +59 -32
- data/spec/spec_helper.rb +14 -6
- data/test/deep_test/agent_test.rb +175 -0
- data/test/deep_test/central_command_test.rb +147 -0
- data/test/deep_test/cpu_info_test.rb +33 -0
- data/test/deep_test/database/mysql_setup_listener_test.rb +13 -9
- data/test/deep_test/demon_test.rb +23 -0
- data/test/deep_test/distributed/beachhead_test.rb +67 -0
- data/test/deep_test/distributed/dispatch_controller_test.rb +130 -177
- data/test/deep_test/distributed/filename_resolver_test.rb +38 -34
- data/test/deep_test/distributed/landing_fleet_test.rb +55 -0
- data/test/deep_test/distributed/landing_ship_test.rb +48 -0
- data/test/deep_test/distributed/remote_deployment_test.rb +134 -0
- data/test/deep_test/distributed/rsync_test.rb +42 -62
- data/test/deep_test/distributed/shell_environment_fixtures/set_bar_to_foo +1 -0
- data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_bar +1 -0
- data/test/deep_test/distributed/shell_environment_fixtures/set_foo_to_baz +1 -0
- data/test/deep_test/distributed/shell_environment_test.rb +108 -0
- data/test/deep_test/distributed/ssh_client_connection_info_test.rb +34 -0
- data/test/deep_test/listener_list_test.rb +17 -15
- data/test/deep_test/local_deployment_test.rb +19 -0
- data/test/deep_test/logger_test.rb +34 -7
- data/test/deep_test/main_test.rb +12 -0
- data/test/deep_test/marshallable_exception_wrapper_test.rb +31 -29
- data/test/deep_test/metrics/data_test.rb +22 -0
- data/test/deep_test/metrics/measurement_test.rb +18 -0
- data/test/deep_test/proxy_io_test.rb +104 -0
- data/test/deep_test/result_reader_test.rb +95 -95
- data/test/deep_test/test/extensions/error_test.rb +38 -36
- data/test/deep_test/test/runner_test.rb +7 -3
- data/test/deep_test/test/supervised_test_suite_test.rb +89 -61
- data/test/deep_test/test/work_result_test.rb +80 -76
- data/test/deep_test/test/work_unit_test.rb +53 -51
- data/test/deep_test/test_task_test.rb +10 -38
- data/test/deep_test/ui/console_test.rb +8 -4
- data/test/deep_test/warlock_test.rb +33 -31
- data/test/test_helper.rb +20 -5
- data/test/test_task_test.rb +60 -57
- metadata +94 -84
- data/bin/deep_test +0 -15
- data/jstorimer-deep-test-0.1.0.gem +0 -0
- data/jstorimer-deep-test.gemspec +0 -1425
- data/lib/deep_test/distributed/drb_client_connection_info.rb +0 -15
- data/lib/deep_test/distributed/master_test_server.rb +0 -52
- data/lib/deep_test/distributed/multi_test_server_proxy.rb +0 -44
- data/lib/deep_test/distributed/null_work_unit.rb +0 -12
- data/lib/deep_test/distributed/remote_worker_client.rb +0 -54
- data/lib/deep_test/distributed/remote_worker_server.rb +0 -82
- data/lib/deep_test/distributed/show_status.rhtml +0 -41
- data/lib/deep_test/distributed/test_server.rb +0 -78
- data/lib/deep_test/distributed/test_server_status.rb +0 -9
- data/lib/deep_test/distributed/test_server_workers.rb +0 -24
- data/lib/deep_test/distributed/throughput_runner.rb +0 -42
- data/lib/deep_test/distributed/throughput_statistics.rb +0 -26
- data/lib/deep_test/distributed/throughput_worker_client.rb +0 -19
- data/lib/deep_test/extensions/drb_extension.rb +0 -34
- data/lib/deep_test/local_workers.rb +0 -55
- data/lib/deep_test/metrics/gatherer.rb +0 -67
- data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +0 -133
- data/lib/deep_test/option.rb +0 -60
- data/lib/deep_test/process_orchestrator.rb +0 -49
- data/lib/deep_test/server.rb +0 -75
- data/lib/deep_test/spec/extensions/reporter.rb +0 -29
- data/lib/deep_test/worker.rb +0 -57
- data/script/internal/run_test_suite.rb +0 -7
- data/script/public/master_test_server.rb +0 -24
- data/script/public/test_server.rb +0 -18
- data/script/public/test_throughput.rb +0 -29
- data/spec/deep_test/option_spec.rb +0 -33
- data/spec/thread_worker.rb +0 -25
- data/test/deep_test/distributed/drb_client_connection_info_test.rb +0 -42
- data/test/deep_test/distributed/master_test_server_test.rb +0 -32
- data/test/deep_test/distributed/multi_test_server_proxy_test.rb +0 -96
- data/test/deep_test/distributed/remote_worker_client_test.rb +0 -180
- data/test/deep_test/distributed/remote_worker_server_test.rb +0 -99
- data/test/deep_test/distributed/test_server_test.rb +0 -94
- data/test/deep_test/distributed/test_server_workers_test.rb +0 -26
- data/test/deep_test/distributed/throughput_runner_test.rb +0 -68
- data/test/deep_test/distributed/throughput_worker_client_test.rb +0 -28
- data/test/deep_test/local_workers_test.rb +0 -22
- data/test/deep_test/metrics/gatherer_test.rb +0 -66
- data/test/deep_test/process_orchestrator_test.rb +0 -11
- data/test/deep_test/server_test.rb +0 -58
- data/test/deep_test/worker_test.rb +0 -94
- data/test/failing.rake +0 -11
- data/test/simple_test_blackboard.rb +0 -45
- data/test/simple_test_blackboard_test.rb +0 -33
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "start_all starts workers on a new worker server" do
|
5
|
-
client = DeepTest::Distributed::ThroughputWorkerClient.new(
|
6
|
-
options = DeepTest::Options.new({}),
|
7
|
-
test_server = stub_everything
|
8
|
-
)
|
9
|
-
|
10
|
-
test_server.expects(:spawn_worker_server).with(options).
|
11
|
-
returns(worker_server = stub_everything)
|
12
|
-
|
13
|
-
worker_server.expects(:start_all)
|
14
|
-
client.start_all
|
15
|
-
end
|
16
|
-
|
17
|
-
test "stop_all stops workers on worker server that was spawned in start_all" do
|
18
|
-
worker_server = stub_everything
|
19
|
-
client = DeepTest::Distributed::ThroughputWorkerClient.new(
|
20
|
-
DeepTest::Options.new({}),
|
21
|
-
test_server = stub_everything(:spawn_worker_server => worker_server)
|
22
|
-
)
|
23
|
-
|
24
|
-
client.start_all
|
25
|
-
worker_server.expects(:stop_all)
|
26
|
-
client.stop_all
|
27
|
-
end
|
28
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "number_of_workers is determined by options" do
|
5
|
-
workers = DeepTest::LocalWorkers.new(
|
6
|
-
DeepTest::Options.new(:number_of_workers => 4)
|
7
|
-
)
|
8
|
-
|
9
|
-
assert_equal 4, workers.number_of_workers
|
10
|
-
end
|
11
|
-
|
12
|
-
test "load_files simply loads each file provided" do
|
13
|
-
workers = DeepTest::LocalWorkers.new(
|
14
|
-
DeepTest::Options.new(:number_of_workers => 4)
|
15
|
-
)
|
16
|
-
|
17
|
-
workers.expects(:load).with(:file_1)
|
18
|
-
workers.expects(:load).with(:file_2)
|
19
|
-
|
20
|
-
workers.load_files([:file_1, :file_2])
|
21
|
-
end
|
22
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "section uses block to add measurements when render is called" do
|
5
|
-
i = j = 0
|
6
|
-
section = DeepTest::Metrics::Gatherer::Section.new("my section") do |s|
|
7
|
-
s.measurement("i", i)
|
8
|
-
s.measurement("j", j)
|
9
|
-
end
|
10
|
-
|
11
|
-
i = 1
|
12
|
-
j = 2
|
13
|
-
|
14
|
-
rendered_string = section.render
|
15
|
-
|
16
|
-
assert_match /^i: 1$/, rendered_string
|
17
|
-
assert_match /^j: 2$/, rendered_string
|
18
|
-
end
|
19
|
-
|
20
|
-
test "section starts with title" do
|
21
|
-
section = DeepTest::Metrics::Gatherer::Section.new("my section") {|s|}
|
22
|
-
assert_equal "[my section]\n", section.render
|
23
|
-
end
|
24
|
-
|
25
|
-
test "gatherer renders all sections defined" do
|
26
|
-
gatherer = DeepTest::Metrics::Gatherer.new(DeepTest::Options.new(:metrics_file => "something"))
|
27
|
-
gatherer.section("section 1") {|s|}
|
28
|
-
gatherer.section("section 2") {|s|}
|
29
|
-
|
30
|
-
assert_equal "[section 1]\n\n[section 2]\n", gatherer.render
|
31
|
-
end
|
32
|
-
|
33
|
-
test "no sections are added if not gathering metrics" do
|
34
|
-
gatherer = DeepTest::Metrics::Gatherer.new(DeepTest::Options.new({}))
|
35
|
-
gatherer.section("section 1") {|s|}
|
36
|
-
gatherer.section("section 2") {|s|}
|
37
|
-
|
38
|
-
assert_equal "", gatherer.render
|
39
|
-
end
|
40
|
-
|
41
|
-
test "enabled? is true if metrics_file is specified" do
|
42
|
-
gatherer = DeepTest::Metrics::Gatherer.new(DeepTest::Options.new(:metrics_file => "something"))
|
43
|
-
assert_equal true, gatherer.enabled?
|
44
|
-
end
|
45
|
-
|
46
|
-
test "enabled? is false if metrics_file is not specified" do
|
47
|
-
gatherer = DeepTest::Metrics::Gatherer.new(DeepTest::Options.new({}))
|
48
|
-
assert_equal false, gatherer.enabled?
|
49
|
-
end
|
50
|
-
|
51
|
-
test "write_file writes rendered contents to metrics file" do
|
52
|
-
gatherer = DeepTest::Metrics::Gatherer.new(
|
53
|
-
DeepTest::Options.new(:metrics_file => "a_file")
|
54
|
-
)
|
55
|
-
gatherer.section("section 1") {|s|}
|
56
|
-
File.expects(:open).with("a_file", "w").yields(io = StringIO.new)
|
57
|
-
gatherer.write_file
|
58
|
-
assert_equal gatherer.render, io.string
|
59
|
-
end
|
60
|
-
|
61
|
-
test "write_file does nothing if not enabled" do
|
62
|
-
gatherer = DeepTest::Metrics::Gatherer.new(DeepTest::Options.new({}))
|
63
|
-
File.expects(:open).never
|
64
|
-
gatherer.write_file
|
65
|
-
end
|
66
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "shutdown calls done_with_work" do
|
5
|
-
orchestrator = DeepTest::ProcessOrchestrator.new(nil, stub_everything, nil)
|
6
|
-
server = mock
|
7
|
-
server.expects(:done_with_work)
|
8
|
-
|
9
|
-
orchestrator.shutdown(server)
|
10
|
-
end
|
11
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "take_work returns result of push_work when it is available" do
|
5
|
-
server = DeepTest::Server.new(DeepTest::Options.new({}))
|
6
|
-
server.write_work :work
|
7
|
-
assert_equal :work, server.take_work
|
8
|
-
end
|
9
|
-
|
10
|
-
test "take_work raises error when no work is currently available" do
|
11
|
-
assert_raises(DeepTest::Server::NoWorkUnitsAvailableError) do
|
12
|
-
DeepTest::Server.new(DeepTest::Options.new({})).take_work
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
test "take_work raises error when there is no work left to" do
|
17
|
-
server = DeepTest::Server.new(DeepTest::Options.new({}))
|
18
|
-
server.done_with_work
|
19
|
-
|
20
|
-
assert_raises(DeepTest::Server::NoWorkUnitsRemainingError) do
|
21
|
-
server.take_work
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
test "take_result returns result of push_result when it is available" do
|
26
|
-
server = DeepTest::Server.new(DeepTest::Options.new({}))
|
27
|
-
t = Thread.new {server.take_result}
|
28
|
-
server.write_result :result
|
29
|
-
assert_equal :result, t.value
|
30
|
-
end
|
31
|
-
|
32
|
-
test "take_result timeouts out after configurable number of seconds" do
|
33
|
-
server = DeepTest::Server.new(
|
34
|
-
DeepTest::Options.new(:timeout_in_seconds => 0.01)
|
35
|
-
)
|
36
|
-
Thread.new {sleep 0.1; server.write_result :too_late}
|
37
|
-
assert_raises(DeepTest::Server::ResultOverdueError) {server.take_result}
|
38
|
-
end
|
39
|
-
|
40
|
-
test "write_work returns nil" do
|
41
|
-
server = DeepTest::Server.new(DeepTest::Options.new({}))
|
42
|
-
assert_equal nil, server.write_work(:a)
|
43
|
-
end
|
44
|
-
|
45
|
-
test "write_result returns nil" do
|
46
|
-
server = DeepTest::Server.new(DeepTest::Options.new({}))
|
47
|
-
assert_equal nil, server.write_result(:a)
|
48
|
-
end
|
49
|
-
|
50
|
-
test "start returns instance of server" do
|
51
|
-
DRb.expects(:start_service)
|
52
|
-
DRb.expects(:uri)
|
53
|
-
DeepTest.logger.expects(:info)
|
54
|
-
|
55
|
-
server = DeepTest::Server.start(DeepTest::Options.new({}))
|
56
|
-
assert_kind_of DeepTest::Server, server
|
57
|
-
end
|
58
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "puts result on blackboard" do
|
5
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
6
|
-
blackboard.write_work DeepTest::Test::WorkUnit.new(TestFactory.passing_test)
|
7
|
-
|
8
|
-
DeepTest::Worker.new(0, blackboard,stub_everything).run
|
9
|
-
|
10
|
-
assert_kind_of Test::Unit::TestResult, blackboard.take_result
|
11
|
-
end
|
12
|
-
|
13
|
-
test "puts passing and failing tests on blackboard for each test" do
|
14
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
15
|
-
blackboard.write_work DeepTest::Test::WorkUnit.new(TestFactory.passing_test)
|
16
|
-
blackboard.write_work DeepTest::Test::WorkUnit.new(TestFactory.failing_test)
|
17
|
-
|
18
|
-
DeepTest::Worker.new(0, blackboard, stub_everything).run
|
19
|
-
|
20
|
-
result_1 = blackboard.take_result
|
21
|
-
result_2 = blackboard.take_result
|
22
|
-
|
23
|
-
assert_equal true, (result_1.passed? || result_2.passed?)
|
24
|
-
assert_equal false, (result_1.passed? && result_2.passed?)
|
25
|
-
end
|
26
|
-
|
27
|
-
test "notifies listener that it is starting" do
|
28
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
29
|
-
listener = stub_everything
|
30
|
-
worker = DeepTest::Worker.new(0, blackboard, listener)
|
31
|
-
listener.expects(:starting).with(worker)
|
32
|
-
worker.run
|
33
|
-
end
|
34
|
-
|
35
|
-
test "notifies listener that it is about to do work" do
|
36
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
37
|
-
work_unit = DeepTest::Test::WorkUnit.new(TestFactory.passing_test)
|
38
|
-
blackboard.write_work work_unit
|
39
|
-
listener = stub_everything
|
40
|
-
worker = DeepTest::Worker.new(0, blackboard, listener)
|
41
|
-
listener.expects(:starting_work).with(worker, work_unit)
|
42
|
-
worker.run
|
43
|
-
end
|
44
|
-
|
45
|
-
test "notifies listener that it has done work" do
|
46
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
47
|
-
work_unit = mock(:run => :result)
|
48
|
-
blackboard.write_work work_unit
|
49
|
-
listener = stub_everything
|
50
|
-
worker = DeepTest::Worker.new(0, blackboard, listener)
|
51
|
-
listener.expects(:finished_work).with(worker, work_unit, :result)
|
52
|
-
worker.run
|
53
|
-
end
|
54
|
-
|
55
|
-
test "exception raised by work unit gives in Worker::Error" do
|
56
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
57
|
-
work_unit = mock
|
58
|
-
work_unit.expects(:run).raises(exception = RuntimeError.new)
|
59
|
-
blackboard.write_work work_unit
|
60
|
-
|
61
|
-
DeepTest::Worker.new(0, blackboard, stub_everything).run
|
62
|
-
|
63
|
-
assert_equal DeepTest::Worker::Error.new(work_unit, exception),
|
64
|
-
blackboard.take_result
|
65
|
-
end
|
66
|
-
|
67
|
-
test "requests work until it finds some" do
|
68
|
-
blackboard = mock
|
69
|
-
blackboard.expects(:take_work).times(3).
|
70
|
-
raises(DeepTest::Server::NoWorkUnitsAvailableError).
|
71
|
-
returns(work_unit = mock(:run => nil)).
|
72
|
-
returns(nil)
|
73
|
-
|
74
|
-
blackboard.expects(:write_result)
|
75
|
-
|
76
|
-
DeepTest::Worker.new(0, blackboard, stub_everything).run
|
77
|
-
end
|
78
|
-
|
79
|
-
test "finishes running when no more work units are remaining" do
|
80
|
-
blackboard = mock
|
81
|
-
blackboard.expects(:take_work).
|
82
|
-
raises(DeepTest::Server::NoWorkUnitsRemainingError)
|
83
|
-
|
84
|
-
DeepTest::Worker.new(0, blackboard, stub_everything).run
|
85
|
-
end
|
86
|
-
|
87
|
-
test "number is available to indentify worker" do
|
88
|
-
assert_equal 1, DeepTest::Worker.new(1, nil, nil).number
|
89
|
-
end
|
90
|
-
|
91
|
-
test "does not fork from rake" do
|
92
|
-
assert !defined?($rakefile)
|
93
|
-
end
|
94
|
-
end
|
data/test/failing.rake
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
3
|
-
require "deep_test"
|
4
|
-
require "deep_test/rake_tasks"
|
5
|
-
|
6
|
-
task :default => %w[deep_test_failing]
|
7
|
-
|
8
|
-
DeepTest::TestTask.new :deep_test_failing do |t|
|
9
|
-
t.number_of_workers = 1
|
10
|
-
t.pattern = "test/failing.rb"
|
11
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module DeepTest
|
2
|
-
class SimpleTestBlackboard
|
3
|
-
attr_accessor :debug, :simulate_result_overdue_error
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
@work_units = []
|
7
|
-
@test_results = []
|
8
|
-
@semaphore = Mutex.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def take_result
|
12
|
-
raise DeepTest::Server::ResultOverdueError if @simulate_result_overdue_error
|
13
|
-
@semaphore.synchronize do
|
14
|
-
log_and_return "take_result", @test_results.shift
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def take_work
|
19
|
-
@semaphore.synchronize do
|
20
|
-
log_and_return "take_work", @work_units.shift
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def write_result(result)
|
25
|
-
@semaphore.synchronize do
|
26
|
-
log_and_return "write_result", result
|
27
|
-
@test_results.push result
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def write_work(work_unit)
|
32
|
-
@semaphore.synchronize do
|
33
|
-
log_and_return "write_work", work_unit
|
34
|
-
@work_units.push work_unit
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def log_and_return(message, object)
|
39
|
-
if debug && object
|
40
|
-
puts "* #{message} #{object.inspect}"
|
41
|
-
end
|
42
|
-
object
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/test_helper"
|
2
|
-
|
3
|
-
unit_tests do
|
4
|
-
test "a test that is put on can be taken off later" do
|
5
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
6
|
-
test_case = TestFactory.passing_test
|
7
|
-
blackboard.write_work test_case
|
8
|
-
assert_equal test_case, blackboard.take_work
|
9
|
-
end
|
10
|
-
|
11
|
-
test "taking a test when all have been taken returns nil" do
|
12
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
13
|
-
test_case = TestFactory.passing_test
|
14
|
-
blackboard.write_work test_case
|
15
|
-
blackboard.take_work
|
16
|
-
assert_nil blackboard.take_work
|
17
|
-
end
|
18
|
-
|
19
|
-
test "a result that is put on can be taken off later" do
|
20
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
21
|
-
result = TestFactory.passed_result
|
22
|
-
blackboard.write_result result
|
23
|
-
assert_equal result, blackboard.take_result
|
24
|
-
end
|
25
|
-
|
26
|
-
test "taking a result when all have been taken returns nil" do
|
27
|
-
blackboard = DeepTest::SimpleTestBlackboard.new
|
28
|
-
result = TestFactory.passed_result
|
29
|
-
blackboard.write_result result
|
30
|
-
blackboard.take_result
|
31
|
-
assert_nil blackboard.take_result
|
32
|
-
end
|
33
|
-
end
|