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
data/test/failing.rake ADDED
@@ -0,0 +1,11 @@
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
data/test/failing.rb ADDED
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+
3
+ unit_tests do
4
+ test "failing" do
5
+ assert false
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ unless defined?(ActiveRecord::StatementInvalid)
2
+ module ActiveRecord
3
+ class StatementInvalid < StandardError
4
+ end
5
+ end
6
+ end
7
+
8
+ class FakeDeadlockError
9
+ def self.new
10
+ ActiveRecord::StatementInvalid.new("Deadlock found when trying to get lock")
11
+ end
12
+ end
@@ -0,0 +1,45 @@
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
@@ -0,0 +1,33 @@
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
@@ -0,0 +1,74 @@
1
+ module TestFactory
2
+ def self.failing_test
3
+ test_class do
4
+ def test_failing
5
+ assert_equal 1, 0
6
+ end
7
+ end.new(:test_failing)
8
+ end
9
+
10
+ def self.passed_result
11
+ result = Test::Unit::TestResult.new
12
+ result.add_run
13
+ result.add_assertion
14
+ result
15
+ end
16
+
17
+ def self.passing_test
18
+ test_class do
19
+ def test_passing
20
+ assert_equal 0, 0
21
+ end
22
+ end.new(:test_passing)
23
+ end
24
+
25
+ def self.passing_test_with_stdout
26
+ test_class do
27
+ def test_passing_with_stdout
28
+ print "message printed to stdout"
29
+ assert true
30
+ end
31
+ end.new :test_passing_with_stdout
32
+ end
33
+
34
+ def self.deadlock_once_test
35
+ test_class do
36
+ def test_deadlock_once
37
+ if @deadlocked
38
+ assert true
39
+ else
40
+ @deadlocked = true
41
+ raise FakeDeadlockError.new
42
+ end
43
+ end
44
+ end.new :test_deadlock_once
45
+ end
46
+
47
+ def self.deadlock_always_test
48
+ test_class do
49
+ def test_deadlock_always
50
+ raise FakeDeadlockError.new
51
+ end
52
+ end.new :test_deadlock_always
53
+ end
54
+
55
+ def self.suite
56
+ Test::Unit::TestSuite.new
57
+ end
58
+
59
+ def self.test_class(&block)
60
+ test_class = Class.new(Test::Unit::TestCase)
61
+
62
+ class_name = external_caller.upcase.gsub(/[^A-Z0-9]/,"_").sub(/^_*/,'')
63
+ const_set(class_name, test_class)
64
+
65
+ test_class.class_eval &block
66
+ test_class
67
+ end
68
+
69
+ def self.external_caller
70
+ caller.each do |trace_line|
71
+ return trace_line unless trace_line =~ /test_factory.rb/
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'dust'
4
+ require 'mocha'
5
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")
6
+ require "deep_test"
7
+ require 'set'
8
+
9
+ require File.dirname(__FILE__) + "/fake_deadlock_error"
10
+ require File.dirname(__FILE__) + "/simple_test_blackboard"
11
+ require File.dirname(__FILE__) + "/test_factory"
12
+ require File.dirname(__FILE__) + "/../spec/thread_worker"
13
+
14
+ class SomeCustomException < RuntimeError
15
+ end
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+
3
+ unit_tests do
4
+ test "defines a rake task with the name passed to the constructor" do
5
+ DeepTest::TestTask.any_instance.stubs(:desc)
6
+ DeepTest::TestTask.any_instance.expects(:task).with(:my_task_name)
7
+ DeepTest::TestTask.new :my_task_name do
8
+ end
9
+ end
10
+
11
+ test "setting pattern" do
12
+ pattern = "test/**/x*_test.rb"
13
+ task = DeepTest::TestTask.new do |t|
14
+ t.stubs(:define)
15
+ t.pattern = pattern
16
+ end
17
+ assert_equal pattern, task.pattern[-pattern.size..-1]
18
+ end
19
+
20
+ test "default pattern is test/**/*_test.rb" do
21
+ task = DeepTest::TestTask.new do |t|
22
+ t.stubs(:define)
23
+ end
24
+ assert_equal "test/**/*_test.rb", task.pattern[-"test/**/*_test.rb".size..-1]
25
+ end
26
+
27
+ test "default libs is ['lib']" do
28
+ task = DeepTest::TestTask.new do |t|
29
+ t.stubs(:define)
30
+ end
31
+ assert_equal ["lib"], task.libs
32
+ end
33
+
34
+ test "can add to libs" do
35
+ task = DeepTest::TestTask.new do |t|
36
+ t.libs << "test"
37
+ t.stubs(:define)
38
+ end
39
+ assert_equal ["lib", "test"], task.libs
40
+ end
41
+
42
+ test "define passes the -I option to the call to ruby" do
43
+ task = DeepTest::TestTask.new do |t|
44
+ t.libs << "test"
45
+ end
46
+ task.expects(:ruby).with(includes("-Ilib:test"))
47
+ Rake::Task["deep_test"].instance_variable_get("@actions").last.call
48
+ end
49
+
50
+ test "define does not pass the -I option to the call to ruby if there are no directories to add to the load path" do
51
+ task = DeepTest::TestTask.new do |t|
52
+ t.libs = []
53
+ end
54
+ task.expects(:ruby).with(Not(includes("-I")))
55
+ Rake::Task["deep_test"].instance_variable_get("@actions").last.call
56
+ end
57
+
58
+ test "number_of_workers defaults to 2" do
59
+ task = DeepTest::TestTask.new do |t|
60
+ t.stubs(:define)
61
+ end
62
+ assert_equal 2, task.number_of_workers
63
+ end
64
+
65
+ test "number_of_workers can be set" do
66
+ task = DeepTest::TestTask.new do |t|
67
+ t.number_of_workers = 42
68
+ t.stubs(:define)
69
+ end
70
+ assert_equal 42, task.number_of_workers
71
+ end
72
+ end
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jason-o-matic-deep_test
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.2.1
5
+ platform: ruby
6
+ authors:
7
+ - anonymous z, Dan Manges, David Vollbracht
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-11 00:00:00 -07:00
13
+ default_executable: deep_test
14
+ dependencies: []
15
+
16
+ description: DeepTest runs tests in multiple processes.
17
+ email: daniel.manges@gmail.com
18
+ executables:
19
+ - deep_test
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - CHANGELOG
25
+ files:
26
+ - lib/deep_test/database/mysql_setup_listener.rb
27
+ - lib/deep_test/database/setup_listener.rb
28
+ - lib/deep_test/deadlock_detector.rb
29
+ - lib/deep_test/distributed/dispatch_controller.rb
30
+ - lib/deep_test/distributed/drb_client_connection_info.rb
31
+ - lib/deep_test/distributed/filename_resolver.rb
32
+ - lib/deep_test/distributed/master_test_server.rb
33
+ - lib/deep_test/distributed/multi_test_server_proxy.rb
34
+ - lib/deep_test/distributed/null_work_unit.rb
35
+ - lib/deep_test/distributed/remote_worker_client.rb
36
+ - lib/deep_test/distributed/remote_worker_server.rb
37
+ - lib/deep_test/distributed/rsync.rb
38
+ - lib/deep_test/distributed/test_server.rb
39
+ - lib/deep_test/distributed/test_server_status.rb
40
+ - lib/deep_test/distributed/test_server_workers.rb
41
+ - lib/deep_test/distributed/throughput_runner.rb
42
+ - lib/deep_test/distributed/throughput_statistics.rb
43
+ - lib/deep_test/distributed/throughput_worker_client.rb
44
+ - lib/deep_test/extensions/drb_extension.rb
45
+ - lib/deep_test/extensions/object_extension.rb
46
+ - lib/deep_test/listener_list.rb
47
+ - lib/deep_test/local_workers.rb
48
+ - lib/deep_test/logger.rb
49
+ - lib/deep_test/marshallable_exception_wrapper.rb
50
+ - lib/deep_test/metrics/gatherer.rb
51
+ - lib/deep_test/metrics/queue_lock_wait_time_measurement.rb
52
+ - lib/deep_test/null_worker_listener.rb
53
+ - lib/deep_test/option.rb
54
+ - lib/deep_test/options.rb
55
+ - lib/deep_test/process_orchestrator.rb
56
+ - lib/deep_test/rake_tasks.rb
57
+ - lib/deep_test/result_reader.rb
58
+ - lib/deep_test/rspec_detector.rb
59
+ - lib/deep_test/server.rb
60
+ - lib/deep_test/spec/extensions/example_group_methods.rb
61
+ - lib/deep_test/spec/extensions/example_methods.rb
62
+ - lib/deep_test/spec/extensions/options.rb
63
+ - lib/deep_test/spec/extensions/reporter.rb
64
+ - lib/deep_test/spec/extensions/spec_task.rb
65
+ - lib/deep_test/spec/runner.rb
66
+ - lib/deep_test/spec/work_result.rb
67
+ - lib/deep_test/spec/work_unit.rb
68
+ - lib/deep_test/spec.rb
69
+ - lib/deep_test/test/extensions/error.rb
70
+ - lib/deep_test/test/runner.rb
71
+ - lib/deep_test/test/supervised_test_suite.rb
72
+ - lib/deep_test/test/work_result.rb
73
+ - lib/deep_test/test/work_unit.rb
74
+ - lib/deep_test/test.rb
75
+ - lib/deep_test/test_task.rb
76
+ - lib/deep_test/ui/console.rb
77
+ - lib/deep_test/ui/null.rb
78
+ - lib/deep_test/warlock.rb
79
+ - lib/deep_test/worker.rb
80
+ - lib/deep_test.rb
81
+ - lib/deep_test/distributed/show_status.rhtml
82
+ - script/internal/run_test_suite.rb
83
+ - script/public/master_test_server.rb
84
+ - script/public/test_server.rb
85
+ - script/public/test_throughput.rb
86
+ - test/deep_test/database/mysql_setup_listener_test.rb
87
+ - test/deep_test/distributed/dispatch_controller_test.rb
88
+ - test/deep_test/distributed/drb_client_connection_info_test.rb
89
+ - test/deep_test/distributed/filename_resolver_test.rb
90
+ - test/deep_test/distributed/master_test_server_test.rb
91
+ - test/deep_test/distributed/multi_test_server_proxy_test.rb
92
+ - test/deep_test/distributed/remote_worker_client_test.rb
93
+ - test/deep_test/distributed/remote_worker_server_test.rb
94
+ - test/deep_test/distributed/rsync_test.rb
95
+ - test/deep_test/distributed/test_server_test.rb
96
+ - test/deep_test/distributed/test_server_workers_test.rb
97
+ - test/deep_test/distributed/throughput_runner_test.rb
98
+ - test/deep_test/distributed/throughput_worker_client_test.rb
99
+ - test/deep_test/extensions/object_extension_test.rb
100
+ - test/deep_test/listener_list_test.rb
101
+ - test/deep_test/local_workers_test.rb
102
+ - test/deep_test/logger_test.rb
103
+ - test/deep_test/marshallable_exception_wrapper_test.rb
104
+ - test/deep_test/metrics/gatherer_test.rb
105
+ - test/deep_test/process_orchestrator_test.rb
106
+ - test/deep_test/result_reader_test.rb
107
+ - test/deep_test/server_test.rb
108
+ - test/deep_test/test/extensions/error_test.rb
109
+ - test/deep_test/test/runner_test.rb
110
+ - test/deep_test/test/supervised_test_suite_test.rb
111
+ - test/deep_test/test/work_result_test.rb
112
+ - test/deep_test/test/work_unit_test.rb
113
+ - test/deep_test/test_task_test.rb
114
+ - test/deep_test/ui/console_test.rb
115
+ - test/deep_test/warlock_test.rb
116
+ - test/deep_test/worker_test.rb
117
+ - test/failing.rb
118
+ - test/fake_deadlock_error.rb
119
+ - test/simple_test_blackboard.rb
120
+ - test/simple_test_blackboard_test.rb
121
+ - test/test_factory.rb
122
+ - test/test_helper.rb
123
+ - test/test_task_test.rb
124
+ - test/failing.rake
125
+ - README.rdoc
126
+ - CHANGELOG
127
+ - Rakefile
128
+ - bin/deep_test
129
+ has_rdoc: true
130
+ homepage: http://deep-test.rubyforge.org
131
+ post_install_message:
132
+ rdoc_options:
133
+ - --title
134
+ - DeepTest
135
+ - --main
136
+ - README.rdoc
137
+ - --line-numbers
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ version:
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: "0"
151
+ version:
152
+ requirements: []
153
+
154
+ rubyforge_project: deep-test
155
+ rubygems_version: 1.2.0
156
+ signing_key:
157
+ specification_version: 2
158
+ summary: DeepTest runs tests in multiple processes.
159
+ test_files: []
160
+