jason-o-matic-deep_test 1.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/CHANGELOG +47 -0
  2. data/README.rdoc +228 -0
  3. data/Rakefile +211 -0
  4. data/bin/deep_test +15 -0
  5. data/lib/deep_test.rb +90 -0
  6. data/lib/deep_test/database/mysql_setup_listener.rb +113 -0
  7. data/lib/deep_test/database/setup_listener.rb +116 -0
  8. data/lib/deep_test/deadlock_detector.rb +7 -0
  9. data/lib/deep_test/distributed/dispatch_controller.rb +53 -0
  10. data/lib/deep_test/distributed/drb_client_connection_info.rb +15 -0
  11. data/lib/deep_test/distributed/filename_resolver.rb +40 -0
  12. data/lib/deep_test/distributed/master_test_server.rb +52 -0
  13. data/lib/deep_test/distributed/multi_test_server_proxy.rb +44 -0
  14. data/lib/deep_test/distributed/null_work_unit.rb +12 -0
  15. data/lib/deep_test/distributed/remote_worker_client.rb +54 -0
  16. data/lib/deep_test/distributed/remote_worker_server.rb +111 -0
  17. data/lib/deep_test/distributed/rsync.rb +37 -0
  18. data/lib/deep_test/distributed/show_status.rhtml +41 -0
  19. data/lib/deep_test/distributed/test_server.rb +79 -0
  20. data/lib/deep_test/distributed/test_server_status.rb +9 -0
  21. data/lib/deep_test/distributed/test_server_workers.rb +24 -0
  22. data/lib/deep_test/distributed/throughput_runner.rb +42 -0
  23. data/lib/deep_test/distributed/throughput_statistics.rb +26 -0
  24. data/lib/deep_test/distributed/throughput_worker_client.rb +19 -0
  25. data/lib/deep_test/extensions/drb_extension.rb +34 -0
  26. data/lib/deep_test/extensions/object_extension.rb +40 -0
  27. data/lib/deep_test/listener_list.rb +17 -0
  28. data/lib/deep_test/local_workers.rb +55 -0
  29. data/lib/deep_test/logger.rb +17 -0
  30. data/lib/deep_test/marshallable_exception_wrapper.rb +44 -0
  31. data/lib/deep_test/metrics/gatherer.rb +67 -0
  32. data/lib/deep_test/metrics/queue_lock_wait_time_measurement.rb +133 -0
  33. data/lib/deep_test/null_worker_listener.rb +65 -0
  34. data/lib/deep_test/option.rb +70 -0
  35. data/lib/deep_test/options.rb +112 -0
  36. data/lib/deep_test/process_orchestrator.rb +49 -0
  37. data/lib/deep_test/rake_tasks.rb +11 -0
  38. data/lib/deep_test/result_reader.rb +36 -0
  39. data/lib/deep_test/rspec_detector.rb +24 -0
  40. data/lib/deep_test/server.rb +75 -0
  41. data/lib/deep_test/spec.rb +12 -0
  42. data/lib/deep_test/spec/extensions/example_group_methods.rb +64 -0
  43. data/lib/deep_test/spec/extensions/example_methods.rb +46 -0
  44. data/lib/deep_test/spec/extensions/options.rb +43 -0
  45. data/lib/deep_test/spec/extensions/reporter.rb +29 -0
  46. data/lib/deep_test/spec/extensions/spec_task.rb +20 -0
  47. data/lib/deep_test/spec/runner.rb +57 -0
  48. data/lib/deep_test/spec/work_result.rb +33 -0
  49. data/lib/deep_test/spec/work_unit.rb +59 -0
  50. data/lib/deep_test/test.rb +10 -0
  51. data/lib/deep_test/test/extensions/error.rb +14 -0
  52. data/lib/deep_test/test/runner.rb +24 -0
  53. data/lib/deep_test/test/supervised_test_suite.rb +49 -0
  54. data/lib/deep_test/test/work_result.rb +34 -0
  55. data/lib/deep_test/test/work_unit.rb +40 -0
  56. data/lib/deep_test/test_task.rb +51 -0
  57. data/lib/deep_test/ui/console.rb +76 -0
  58. data/lib/deep_test/ui/null.rb +17 -0
  59. data/lib/deep_test/warlock.rb +134 -0
  60. data/lib/deep_test/worker.rb +57 -0
  61. data/script/internal/run_test_suite.rb +7 -0
  62. data/script/public/master_test_server.rb +24 -0
  63. data/script/public/test_server.rb +18 -0
  64. data/script/public/test_throughput.rb +29 -0
  65. data/test/deep_test/database/mysql_setup_listener_test.rb +14 -0
  66. data/test/deep_test/distributed/dispatch_controller_test.rb +209 -0
  67. data/test/deep_test/distributed/drb_client_connection_info_test.rb +42 -0
  68. data/test/deep_test/distributed/filename_resolver_test.rb +52 -0
  69. data/test/deep_test/distributed/master_test_server_test.rb +32 -0
  70. data/test/deep_test/distributed/multi_test_server_proxy_test.rb +96 -0
  71. data/test/deep_test/distributed/remote_worker_client_test.rb +180 -0
  72. data/test/deep_test/distributed/remote_worker_server_test.rb +107 -0
  73. data/test/deep_test/distributed/rsync_test.rb +67 -0
  74. data/test/deep_test/distributed/test_server_test.rb +94 -0
  75. data/test/deep_test/distributed/test_server_workers_test.rb +26 -0
  76. data/test/deep_test/distributed/throughput_runner_test.rb +68 -0
  77. data/test/deep_test/distributed/throughput_worker_client_test.rb +28 -0
  78. data/test/deep_test/extensions/object_extension_test.rb +37 -0
  79. data/test/deep_test/listener_list_test.rb +20 -0
  80. data/test/deep_test/local_workers_test.rb +22 -0
  81. data/test/deep_test/logger_test.rb +11 -0
  82. data/test/deep_test/marshallable_exception_wrapper_test.rb +44 -0
  83. data/test/deep_test/metrics/gatherer_test.rb +66 -0
  84. data/test/deep_test/process_orchestrator_test.rb +11 -0
  85. data/test/deep_test/result_reader_test.rb +128 -0
  86. data/test/deep_test/server_test.rb +58 -0
  87. data/test/deep_test/test/extensions/error_test.rb +40 -0
  88. data/test/deep_test/test/runner_test.rb +7 -0
  89. data/test/deep_test/test/supervised_test_suite_test.rb +79 -0
  90. data/test/deep_test/test/work_result_test.rb +81 -0
  91. data/test/deep_test/test/work_unit_test.rb +61 -0
  92. data/test/deep_test/test_task_test.rb +43 -0
  93. data/test/deep_test/ui/console_test.rb +9 -0
  94. data/test/deep_test/warlock_test.rb +38 -0
  95. data/test/deep_test/worker_test.rb +94 -0
  96. data/test/failing.rake +11 -0
  97. data/test/failing.rb +7 -0
  98. data/test/fake_deadlock_error.rb +12 -0
  99. data/test/simple_test_blackboard.rb +45 -0
  100. data/test/simple_test_blackboard_test.rb +33 -0
  101. data/test/test_factory.rb +74 -0
  102. data/test/test_helper.rb +15 -0
  103. data/test/test_task_test.rb +72 -0
  104. metadata +160 -0
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "number_of_workers is determined by mirror server options" do
5
+ workers = DeepTest::Distributed::TestServerWorkers.new(
6
+ DeepTest::Options.new({}),
7
+ {:number_of_workers => 4},
8
+ mock
9
+ )
10
+
11
+ assert_equal 4, workers.number_of_workers
12
+ end
13
+
14
+ test "server is retrieved using client connection information" do
15
+ workers = DeepTest::Distributed::TestServerWorkers.new(
16
+ options = DeepTest::Options.new({}),
17
+ {:number_of_workers => 4},
18
+ mock(:address => "address")
19
+ )
20
+ DeepTest::Server.expects(:remote_reference).
21
+ with("address", options.server_port).
22
+ returns(:server_reference)
23
+
24
+ assert_equal :server_reference, workers.server
25
+ end
26
+ end
@@ -0,0 +1,68 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "runner adds specified number of work units to blackboard" do
5
+ blackboard = DeepTest::SimpleTestBlackboard.new
6
+ runner = DeepTest::Distributed::ThroughputRunner.new(
7
+ DeepTest::Options.new({}),
8
+ 5,
9
+ blackboard
10
+ )
11
+
12
+ worker = ThreadWorker.new(blackboard, 5)
13
+ Timeout.timeout(5) do
14
+ runner.process_work_units
15
+ end
16
+ worker.wait_until_done
17
+ end
18
+
19
+ test "runner yields all results from blackboard" do
20
+ blackboard = DeepTest::SimpleTestBlackboard.new
21
+ count = 0
22
+ runner = DeepTest::Distributed::ThroughputRunner.new(
23
+ DeepTest::Options.new({}),
24
+ 2,
25
+ blackboard
26
+ ) do |result|
27
+ assert_equal :null_work_unit_result, result
28
+ count += 1
29
+ end
30
+
31
+ worker = ThreadWorker.new(blackboard, 2)
32
+ Timeout.timeout(5) do
33
+ runner.process_work_units
34
+ end
35
+ worker.wait_until_done
36
+
37
+ assert_equal 2, count
38
+ end
39
+
40
+ test "statistics are available after run" do
41
+ blackboard = DeepTest::SimpleTestBlackboard.new
42
+ runner = DeepTest::Distributed::ThroughputRunner.new(
43
+ DeepTest::Options.new({}),
44
+ 2,
45
+ blackboard
46
+ )
47
+
48
+ worker = ThreadWorker.new(blackboard, 2)
49
+ count = 0
50
+ Timeout.timeout(5) do
51
+ runner.process_work_units
52
+ end
53
+ worker.wait_until_done
54
+
55
+ assert_kind_of DeepTest::Distributed::ThroughputStatistics,
56
+ runner.statistics
57
+ end
58
+
59
+ test "runner returns true" do
60
+ runner = DeepTest::Distributed::ThroughputRunner.new(
61
+ DeepTest::Options.new({}),
62
+ 0,
63
+ DeepTest::SimpleTestBlackboard.new
64
+ )
65
+
66
+ assert_equal true, runner.process_work_units
67
+ end
68
+ end
@@ -0,0 +1,28 @@
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
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + "/../../test_helper"
2
+
3
+ unit_tests do
4
+ test "retrying once" do
5
+ object = Object.new
6
+ object.expects(:call_it_twice).times(2).raises(RuntimeError).then.returns(:ok)
7
+ result = nil
8
+ capture_stdout do
9
+ result = retrying do
10
+ object.call_it_twice
11
+ end
12
+ end
13
+ assert_equal :ok, result
14
+ end
15
+
16
+ test "retrying defaults to 5 times" do
17
+ object = Object.new
18
+ object.expects(:may_i_please_have_another).times(5).
19
+ raises(RuntimeError).raises(RuntimeError).raises(RuntimeError).raises(RuntimeError).returns("ok")
20
+ capture_stdout do
21
+ retrying do
22
+ object.may_i_please_have_another
23
+ end
24
+ end
25
+ end
26
+
27
+ test "retrying raises exception if still failing after number of attempts" do
28
+ my_error = Class.new(StandardError)
29
+ assert_raises(my_error) do
30
+ capture_stdout do
31
+ retrying "", 1 do
32
+ raise my_error
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ unit_tests do
4
+ test "forwards methods defined in NullWorkerListener to all listeners" do
5
+ listener_1, listener_2 = mock, mock
6
+ list = DeepTest::ListenerList.new([listener_1, listener_2])
7
+ listener_1.expects(:starting).with(:worker)
8
+ listener_2.expects(:starting).with(:worker)
9
+ listener_1.expects(:starting_work).with(:worker, :work)
10
+ listener_2.expects(:starting_work).with(:worker, :work)
11
+ list.starting(:worker)
12
+ list.starting_work(:worker, :work)
13
+ end
14
+
15
+ test "doesn't forward methods not defined in NullWorkerListener" do
16
+ listener = mock
17
+ listener.expects(:to_s).never
18
+ DeepTest::ListenerList.new([listener]).to_s
19
+ end
20
+ end
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ unit_tests do
4
+ test "info log level by default" do
5
+ assert_equal Logger::INFO, DeepTest.logger.level
6
+ end
7
+
8
+ test "formatter uses msg only" do
9
+ assert_equal "[DeepTest] my_msg\n", DeepTest.logger.formatter.call(nil, nil, nil, "my_msg")
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ unit_tests do
4
+ test "loading a marshallable exception evals the classname and returns an instance of the original exception" do
5
+ original = RuntimeError.new "message"
6
+ original.set_backtrace ['1', '2']
7
+
8
+ marshalled = DeepTest::MarshallableExceptionWrapper.new(original)
9
+ DeepTest::MarshallableExceptionWrapper.any_instance.expects(:eval).
10
+ with("::RuntimeError").returns(RuntimeError)
11
+
12
+ loaded = Marshal.load(Marshal.dump(marshalled)).resolve
13
+
14
+ assert_equal original.class, loaded.class
15
+ assert_equal original.message, loaded.message
16
+ assert_equal original.backtrace, loaded.backtrace
17
+ end
18
+
19
+ test "loading a marshallable exception when class is not available returns an instance of unloadable exception" do
20
+ original = RuntimeError.new "message"
21
+ original.set_backtrace ['1', '2']
22
+
23
+ marshalled = DeepTest::MarshallableExceptionWrapper.new(original)
24
+ DeepTest::MarshallableExceptionWrapper.any_instance.expects(:eval).
25
+ raises("Eval Error")
26
+
27
+ loaded = Marshal.load(Marshal.dump(marshalled)).resolve
28
+
29
+ assert_equal DeepTest::UnloadableException, loaded.class
30
+ assert_equal "RuntimeError: " + original.message, loaded.message
31
+ assert_equal original.backtrace, loaded.backtrace
32
+ end
33
+
34
+ test "loading a marshallable exception when class init throws an error returns an unloadable exception" do
35
+ original = RuntimeError.new "message"
36
+
37
+ marshalled = DeepTest::MarshallableExceptionWrapper.new(original)
38
+ RuntimeError.expects(:new).raises(StandardError.new)
39
+
40
+ loaded = Marshal.load(Marshal.dump(marshalled)).resolve
41
+
42
+ assert_equal DeepTest::UnloadableException, loaded.class
43
+ end
44
+ end
@@ -0,0 +1,66 @@
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
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,128 @@
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+
3
+ unit_tests do
4
+
5
+ class FakeResult
6
+ attr_reader :identifier
7
+ def initialize(i) @identifier = i; end
8
+ def ==(other) identifier == other.identifier; end
9
+ end
10
+
11
+ test "reads all as many results as requested" do
12
+ blackboard = DeepTest::SimpleTestBlackboard.new
13
+ 1.upto(4) {|i| blackboard.write_result FakeResult.new(i)}
14
+ work_units = {1 => "One", 2 => "Two", 3 => "Three"}
15
+ DeepTest::ResultReader.new(blackboard).read(work_units) {}
16
+ assert_equal FakeResult.new(4), blackboard.take_result
17
+ end
18
+
19
+ test "returns unread tests on ResultOverdueError" do
20
+ blackboard = DeepTest::SimpleTestBlackboard.new
21
+ blackboard.simulate_result_overdue_error = true
22
+ work_units = {1 => "One"}
23
+ DeepTest.logger.expects(:error)
24
+ DeepTest::ResultReader.new(blackboard).read(work_units) {}
25
+ assert_equal({1 => "One"}, work_units)
26
+ end
27
+
28
+ test "yields each result" do
29
+ blackboard = DeepTest::SimpleTestBlackboard.new
30
+ 1.upto(3) {|i| blackboard.write_result FakeResult.new(i)}
31
+ results = []
32
+ work_units = {1 => "One", 2 => "Two", 3 => "Three"}
33
+ DeepTest::ResultReader.new(blackboard).read(work_units) {|r| results << r}
34
+ assert_equal [["One", FakeResult.new(1)],
35
+ ["Two", FakeResult.new(2)],
36
+ ["Three", FakeResult.new(3)]],
37
+ results
38
+ end
39
+
40
+ test "keeps attempting to read results when none are available" do
41
+ blackboard = DeepTest::SimpleTestBlackboard.new
42
+ work_units = {1 => "One", 2 => "Two", 3 => "Three"}
43
+ t = Thread.new {DeepTest::ResultReader.new(blackboard).read(work_units) {}}
44
+ 1.upto(4) {|i| blackboard.write_result FakeResult.new(i)}
45
+ t.join
46
+ assert_equal FakeResult.new(4), blackboard.take_result
47
+ end
48
+
49
+ test "doesn't yield empty results" do
50
+ blackboard = DeepTest::SimpleTestBlackboard.new
51
+ results = []
52
+ t = Thread.new {DeepTest::ResultReader.new(blackboard).read(1 => "One") {|r| results << r}}
53
+ blackboard.write_result FakeResult.new(1)
54
+ t.join
55
+ assert_equal [["One", FakeResult.new(1)]], results
56
+ end
57
+
58
+ test "prints output if result has output" do
59
+ blackboard = DeepTest::SimpleTestBlackboard.new
60
+ blackboard.write_result mock(:output => "output", :identifier => 1)
61
+
62
+ out = capture_stdout do
63
+ DeepTest::ResultReader.new(blackboard).read(1 => "One") {}
64
+ end
65
+
66
+ assert_equal "output", out
67
+ end
68
+
69
+ test "doesn't print any output if output is nil" do
70
+ blackboard = DeepTest::SimpleTestBlackboard.new
71
+ blackboard.write_result mock(:output => nil, :identifier => 1)
72
+
73
+ out = capture_stdout do
74
+ DeepTest::ResultReader.new(blackboard).read(1 => "One") {}
75
+ end
76
+
77
+ assert_equal "", out
78
+ end
79
+
80
+ test "prints useful error information in case of Worker::Error" do
81
+ error = RuntimeError.new "message"
82
+ error.set_backtrace ['a', 'b']
83
+
84
+ blackboard = DeepTest::SimpleTestBlackboard.new
85
+ blackboard.write_result DeepTest::Worker::Error.new("work_unit", error)
86
+
87
+
88
+ out = capture_stdout do
89
+ DeepTest::ResultReader.new(blackboard).read(1 => "One") {}
90
+ end
91
+
92
+ assert_equal "work_unit: message\na\nb\n", out
93
+ end
94
+
95
+ test "doesn't yield Worker::Error results" do
96
+ blackboard = DeepTest::SimpleTestBlackboard.new
97
+ blackboard.write_result DeepTest::Worker::Error.new("work_unit", RuntimeError.new)
98
+
99
+
100
+ results = []
101
+ capture_stdout do
102
+ DeepTest::ResultReader.new(blackboard).read(1 => "One") {|r| results << r}
103
+ end
104
+
105
+ assert_equal [], results
106
+ end
107
+
108
+ test "doesn't modify original work unit hash" do
109
+ blackboard = DeepTest::SimpleTestBlackboard.new
110
+ blackboard.write_result FakeResult.new(1)
111
+ work_units = {1 => "One"}
112
+ DeepTest::ResultReader.new(blackboard).read(work_units) {}
113
+ assert_equal({1 => "One"}, work_units)
114
+ end
115
+
116
+ test "returns remaining tests that didn't have errors" do
117
+ blackboard = DeepTest::SimpleTestBlackboard.new
118
+ blackboard.write_result FakeResult.new(1)
119
+ blackboard.write_result DeepTest::Worker::Error.new("work_unit", RuntimeError.new)
120
+
121
+ work_units = {1 => "One", 2 => "Two"}
122
+
123
+ capture_stdout do
124
+ missing_work_units = DeepTest::ResultReader.new(blackboard).read(work_units) {}
125
+ assert_equal({2 => "Two"}, missing_work_units)
126
+ end
127
+ end
128
+ end