arturop-hydra 0.23.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +39 -0
- data/Rakefile +56 -0
- data/TODO +18 -0
- data/VERSION +1 -0
- data/caliper.yml +6 -0
- data/hydra-icon-64x64.png +0 -0
- data/hydra.gemspec +131 -0
- data/hydra_gray.png +0 -0
- data/lib/hydra.rb +16 -0
- data/lib/hydra/cucumber/formatter.rb +29 -0
- data/lib/hydra/hash.rb +16 -0
- data/lib/hydra/js/lint.js +5150 -0
- data/lib/hydra/listener/abstract.rb +39 -0
- data/lib/hydra/listener/minimal_output.rb +24 -0
- data/lib/hydra/listener/notifier.rb +17 -0
- data/lib/hydra/listener/progress_bar.rb +48 -0
- data/lib/hydra/listener/report_generator.rb +30 -0
- data/lib/hydra/master.rb +247 -0
- data/lib/hydra/message.rb +47 -0
- data/lib/hydra/message/master_messages.rb +19 -0
- data/lib/hydra/message/runner_messages.rb +46 -0
- data/lib/hydra/message/worker_messages.rb +52 -0
- data/lib/hydra/messaging_io.rb +49 -0
- data/lib/hydra/pipe.rb +61 -0
- data/lib/hydra/runner.rb +306 -0
- data/lib/hydra/runner_listener/abstract.rb +23 -0
- data/lib/hydra/safe_fork.rb +31 -0
- data/lib/hydra/spec/autorun_override.rb +3 -0
- data/lib/hydra/spec/hydra_formatter.rb +26 -0
- data/lib/hydra/ssh.rb +41 -0
- data/lib/hydra/stdio.rb +16 -0
- data/lib/hydra/sync.rb +99 -0
- data/lib/hydra/tasks.rb +366 -0
- data/lib/hydra/tmpdir.rb +11 -0
- data/lib/hydra/trace.rb +24 -0
- data/lib/hydra/worker.rb +168 -0
- data/test/fixtures/assert_true.rb +7 -0
- data/test/fixtures/config.yml +4 -0
- data/test/fixtures/conflicting.rb +10 -0
- data/test/fixtures/features/step_definitions.rb +21 -0
- data/test/fixtures/features/write_alternate_file.feature +7 -0
- data/test/fixtures/features/write_file.feature +7 -0
- data/test/fixtures/hello_world.rb +3 -0
- data/test/fixtures/hydra_worker_init.rb +2 -0
- data/test/fixtures/js_file.js +4 -0
- data/test/fixtures/json_data.json +4 -0
- data/test/fixtures/many_outputs_to_console.rb +9 -0
- data/test/fixtures/master_listeners.rb +10 -0
- data/test/fixtures/runner_listeners.rb +23 -0
- data/test/fixtures/slow.rb +9 -0
- data/test/fixtures/sync_test.rb +8 -0
- data/test/fixtures/task_test_config.yml +6 -0
- data/test/fixtures/write_file.rb +10 -0
- data/test/fixtures/write_file_alternate_spec.rb +10 -0
- data/test/fixtures/write_file_spec.rb +9 -0
- data/test/fixtures/write_file_with_pending_spec.rb +11 -0
- data/test/master_test.rb +383 -0
- data/test/message_test.rb +31 -0
- data/test/pipe_test.rb +38 -0
- data/test/runner_test.rb +196 -0
- data/test/ssh_test.rb +25 -0
- data/test/sync_test.rb +113 -0
- data/test/task_test.rb +21 -0
- data/test/test_helper.rb +107 -0
- data/test/worker_test.rb +60 -0
- metadata +202 -0
data/test/worker_test.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class WorkerTest < Test::Unit::TestCase
|
4
|
+
context "with a file to test and a destination to verify" do
|
5
|
+
setup do
|
6
|
+
FileUtils.rm_f(target_file)
|
7
|
+
end
|
8
|
+
|
9
|
+
teardown do
|
10
|
+
FileUtils.rm_f(target_file)
|
11
|
+
end
|
12
|
+
|
13
|
+
# run the worker in the foreground and the requests in the background
|
14
|
+
should "run a test in the foreground" do
|
15
|
+
num_runners = 4
|
16
|
+
pipe = Hydra::Pipe.new
|
17
|
+
child = Process.fork do
|
18
|
+
request_a_file_and_verify_completion(pipe, num_runners)
|
19
|
+
end
|
20
|
+
run_the_worker(pipe, num_runners)
|
21
|
+
Process.wait(child)
|
22
|
+
end
|
23
|
+
|
24
|
+
# inverse of the above test to run the worker in the background
|
25
|
+
should "run a test in the background" do
|
26
|
+
num_runners = 4
|
27
|
+
pipe = Hydra::Pipe.new
|
28
|
+
child = Process.fork do
|
29
|
+
run_the_worker(pipe, num_runners)
|
30
|
+
end
|
31
|
+
request_a_file_and_verify_completion(pipe, num_runners)
|
32
|
+
Process.wait(child)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module WorkerTestHelper
|
37
|
+
def run_the_worker(pipe, num_runners)
|
38
|
+
pipe.identify_as_child
|
39
|
+
Hydra::Worker.new({:io => pipe, :runners => num_runners})
|
40
|
+
end
|
41
|
+
|
42
|
+
def request_a_file_and_verify_completion(pipe, num_runners)
|
43
|
+
pipe.identify_as_parent
|
44
|
+
pipe.gets # grab the WorkerBegin
|
45
|
+
num_runners.times do
|
46
|
+
response = pipe.gets # grab the RequestFile
|
47
|
+
assert response.is_a?(Hydra::Messages::Worker::RequestFile), "Expected RequestFile but got #{response.class.to_s}"
|
48
|
+
end
|
49
|
+
pipe.write(Hydra::Messages::Master::RunFile.new(:file => test_file))
|
50
|
+
|
51
|
+
assert pipe.gets.is_a?(Hydra::Messages::Worker::Results)
|
52
|
+
|
53
|
+
pipe.write(Hydra::Messages::Master::Shutdown.new)
|
54
|
+
|
55
|
+
assert File.exists?(target_file)
|
56
|
+
assert_equal "HYDRA", File.read(target_file)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
include WorkerTestHelper
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arturop-hydra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 75
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 23
|
9
|
+
- 4
|
10
|
+
version: 0.23.4
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Nick Gauthier
|
14
|
+
- Arturo Pie
|
15
|
+
- Sean Kirby
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2011-06-06 00:00:00 -04:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: shoulda
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - "="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 33
|
32
|
+
segments:
|
33
|
+
- 2
|
34
|
+
- 10
|
35
|
+
- 3
|
36
|
+
version: 2.10.3
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rspec
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - "="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 62196421
|
48
|
+
segments:
|
49
|
+
- 2
|
50
|
+
- 0
|
51
|
+
- 0
|
52
|
+
- beta
|
53
|
+
- 19
|
54
|
+
version: 2.0.0.beta.19
|
55
|
+
type: :development
|
56
|
+
version_requirements: *id002
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: cucumber
|
59
|
+
prerelease: false
|
60
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - "="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 63
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
- 9
|
69
|
+
- 2
|
70
|
+
version: 0.9.2
|
71
|
+
type: :development
|
72
|
+
version_requirements: *id003
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: therubyracer
|
75
|
+
prerelease: false
|
76
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - "="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 11
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
- 7
|
85
|
+
- 4
|
86
|
+
version: 0.7.4
|
87
|
+
type: :development
|
88
|
+
version_requirements: *id004
|
89
|
+
description: Spread your tests over multiple machines to test your code faster.
|
90
|
+
email: nick@smartlogicsolutions.com
|
91
|
+
executables: []
|
92
|
+
|
93
|
+
extensions: []
|
94
|
+
|
95
|
+
extra_rdoc_files:
|
96
|
+
- LICENSE
|
97
|
+
- README.rdoc
|
98
|
+
- TODO
|
99
|
+
files:
|
100
|
+
- .document
|
101
|
+
- LICENSE
|
102
|
+
- README.rdoc
|
103
|
+
- Rakefile
|
104
|
+
- TODO
|
105
|
+
- VERSION
|
106
|
+
- caliper.yml
|
107
|
+
- hydra-icon-64x64.png
|
108
|
+
- hydra.gemspec
|
109
|
+
- hydra_gray.png
|
110
|
+
- lib/hydra.rb
|
111
|
+
- lib/hydra/cucumber/formatter.rb
|
112
|
+
- lib/hydra/hash.rb
|
113
|
+
- lib/hydra/js/lint.js
|
114
|
+
- lib/hydra/listener/abstract.rb
|
115
|
+
- lib/hydra/listener/minimal_output.rb
|
116
|
+
- lib/hydra/listener/notifier.rb
|
117
|
+
- lib/hydra/listener/progress_bar.rb
|
118
|
+
- lib/hydra/listener/report_generator.rb
|
119
|
+
- lib/hydra/master.rb
|
120
|
+
- lib/hydra/message.rb
|
121
|
+
- lib/hydra/message/master_messages.rb
|
122
|
+
- lib/hydra/message/runner_messages.rb
|
123
|
+
- lib/hydra/message/worker_messages.rb
|
124
|
+
- lib/hydra/messaging_io.rb
|
125
|
+
- lib/hydra/pipe.rb
|
126
|
+
- lib/hydra/runner.rb
|
127
|
+
- lib/hydra/runner_listener/abstract.rb
|
128
|
+
- lib/hydra/safe_fork.rb
|
129
|
+
- lib/hydra/spec/autorun_override.rb
|
130
|
+
- lib/hydra/spec/hydra_formatter.rb
|
131
|
+
- lib/hydra/ssh.rb
|
132
|
+
- lib/hydra/stdio.rb
|
133
|
+
- lib/hydra/sync.rb
|
134
|
+
- lib/hydra/tasks.rb
|
135
|
+
- lib/hydra/tmpdir.rb
|
136
|
+
- lib/hydra/trace.rb
|
137
|
+
- lib/hydra/worker.rb
|
138
|
+
- test/fixtures/assert_true.rb
|
139
|
+
- test/fixtures/config.yml
|
140
|
+
- test/fixtures/conflicting.rb
|
141
|
+
- test/fixtures/features/step_definitions.rb
|
142
|
+
- test/fixtures/features/write_alternate_file.feature
|
143
|
+
- test/fixtures/features/write_file.feature
|
144
|
+
- test/fixtures/hello_world.rb
|
145
|
+
- test/fixtures/hydra_worker_init.rb
|
146
|
+
- test/fixtures/js_file.js
|
147
|
+
- test/fixtures/json_data.json
|
148
|
+
- test/fixtures/many_outputs_to_console.rb
|
149
|
+
- test/fixtures/master_listeners.rb
|
150
|
+
- test/fixtures/runner_listeners.rb
|
151
|
+
- test/fixtures/slow.rb
|
152
|
+
- test/fixtures/sync_test.rb
|
153
|
+
- test/fixtures/task_test_config.yml
|
154
|
+
- test/fixtures/write_file.rb
|
155
|
+
- test/fixtures/write_file_alternate_spec.rb
|
156
|
+
- test/fixtures/write_file_spec.rb
|
157
|
+
- test/fixtures/write_file_with_pending_spec.rb
|
158
|
+
- test/master_test.rb
|
159
|
+
- test/message_test.rb
|
160
|
+
- test/pipe_test.rb
|
161
|
+
- test/runner_test.rb
|
162
|
+
- test/ssh_test.rb
|
163
|
+
- test/sync_test.rb
|
164
|
+
- test/task_test.rb
|
165
|
+
- test/test_helper.rb
|
166
|
+
- test/worker_test.rb
|
167
|
+
has_rdoc: true
|
168
|
+
homepage: http://github.com/ngauthier/hydra
|
169
|
+
licenses: []
|
170
|
+
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
hash: 3
|
182
|
+
segments:
|
183
|
+
- 0
|
184
|
+
version: "0"
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
hash: 3
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
version: "0"
|
194
|
+
requirements: []
|
195
|
+
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 1.3.7
|
198
|
+
signing_key:
|
199
|
+
specification_version: 3
|
200
|
+
summary: Distributed testing toolkit
|
201
|
+
test_files: []
|
202
|
+
|