ngauthier-hydra 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.rdoc +51 -0
- data/Rakefile +8 -0
- data/TODO +18 -0
- data/hydra-icon-64x64.png +0 -0
- data/hydra.gemspec +24 -0
- data/hydra_gray.png +0 -0
- data/lib/hydra.rb +16 -0
- data/lib/hydra/cucumber/formatter.rb +29 -0
- data/lib/hydra/cucumber/partial_html.rb +24 -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/cucumber.css +279 -0
- data/lib/hydra/listener/cucumber_html_report.rb +148 -0
- data/lib/hydra/listener/jquery-min.js +154 -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 +33 -0
- data/lib/hydra/master.rb +248 -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 +312 -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 +375 -0
- data/lib/hydra/tmpdir.rb +11 -0
- data/lib/hydra/trace.rb +24 -0
- data/lib/hydra/version.rb +3 -0
- data/lib/hydra/worker.rb +170 -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 +229 -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,229 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ngauthier-hydra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.24.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Gauthier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: shoulda
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.10.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.10.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.0.beta.19
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.0.beta.19
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cucumber
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.9.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.9.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: therubyracer
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.7.4
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.7.4
|
97
|
+
description: Spread your tests over multiple machines to test your code faster.
|
98
|
+
email:
|
99
|
+
- ngauthier@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.rdoc
|
108
|
+
- Rakefile
|
109
|
+
- TODO
|
110
|
+
- hydra-icon-64x64.png
|
111
|
+
- hydra.gemspec
|
112
|
+
- hydra_gray.png
|
113
|
+
- lib/hydra.rb
|
114
|
+
- lib/hydra/cucumber/formatter.rb
|
115
|
+
- lib/hydra/cucumber/partial_html.rb
|
116
|
+
- lib/hydra/hash.rb
|
117
|
+
- lib/hydra/js/lint.js
|
118
|
+
- lib/hydra/listener/abstract.rb
|
119
|
+
- lib/hydra/listener/cucumber.css
|
120
|
+
- lib/hydra/listener/cucumber_html_report.rb
|
121
|
+
- lib/hydra/listener/jquery-min.js
|
122
|
+
- lib/hydra/listener/minimal_output.rb
|
123
|
+
- lib/hydra/listener/notifier.rb
|
124
|
+
- lib/hydra/listener/progress_bar.rb
|
125
|
+
- lib/hydra/listener/report_generator.rb
|
126
|
+
- lib/hydra/master.rb
|
127
|
+
- lib/hydra/message.rb
|
128
|
+
- lib/hydra/message/master_messages.rb
|
129
|
+
- lib/hydra/message/runner_messages.rb
|
130
|
+
- lib/hydra/message/worker_messages.rb
|
131
|
+
- lib/hydra/messaging_io.rb
|
132
|
+
- lib/hydra/pipe.rb
|
133
|
+
- lib/hydra/runner.rb
|
134
|
+
- lib/hydra/runner_listener/abstract.rb
|
135
|
+
- lib/hydra/safe_fork.rb
|
136
|
+
- lib/hydra/spec/autorun_override.rb
|
137
|
+
- lib/hydra/spec/hydra_formatter.rb
|
138
|
+
- lib/hydra/ssh.rb
|
139
|
+
- lib/hydra/stdio.rb
|
140
|
+
- lib/hydra/sync.rb
|
141
|
+
- lib/hydra/tasks.rb
|
142
|
+
- lib/hydra/tmpdir.rb
|
143
|
+
- lib/hydra/trace.rb
|
144
|
+
- lib/hydra/version.rb
|
145
|
+
- lib/hydra/worker.rb
|
146
|
+
- test/fixtures/assert_true.rb
|
147
|
+
- test/fixtures/config.yml
|
148
|
+
- test/fixtures/conflicting.rb
|
149
|
+
- test/fixtures/features/step_definitions.rb
|
150
|
+
- test/fixtures/features/write_alternate_file.feature
|
151
|
+
- test/fixtures/features/write_file.feature
|
152
|
+
- test/fixtures/hello_world.rb
|
153
|
+
- test/fixtures/hydra_worker_init.rb
|
154
|
+
- test/fixtures/js_file.js
|
155
|
+
- test/fixtures/json_data.json
|
156
|
+
- test/fixtures/many_outputs_to_console.rb
|
157
|
+
- test/fixtures/master_listeners.rb
|
158
|
+
- test/fixtures/runner_listeners.rb
|
159
|
+
- test/fixtures/slow.rb
|
160
|
+
- test/fixtures/sync_test.rb
|
161
|
+
- test/fixtures/task_test_config.yml
|
162
|
+
- test/fixtures/write_file.rb
|
163
|
+
- test/fixtures/write_file_alternate_spec.rb
|
164
|
+
- test/fixtures/write_file_spec.rb
|
165
|
+
- test/fixtures/write_file_with_pending_spec.rb
|
166
|
+
- test/master_test.rb
|
167
|
+
- test/message_test.rb
|
168
|
+
- test/pipe_test.rb
|
169
|
+
- test/runner_test.rb
|
170
|
+
- test/ssh_test.rb
|
171
|
+
- test/sync_test.rb
|
172
|
+
- test/task_test.rb
|
173
|
+
- test/test_helper.rb
|
174
|
+
- test/worker_test.rb
|
175
|
+
homepage: http://github.com/ngauthier/hydra
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.0.3
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: Distributed testing toolkit
|
199
|
+
test_files:
|
200
|
+
- test/fixtures/assert_true.rb
|
201
|
+
- test/fixtures/config.yml
|
202
|
+
- test/fixtures/conflicting.rb
|
203
|
+
- test/fixtures/features/step_definitions.rb
|
204
|
+
- test/fixtures/features/write_alternate_file.feature
|
205
|
+
- test/fixtures/features/write_file.feature
|
206
|
+
- test/fixtures/hello_world.rb
|
207
|
+
- test/fixtures/hydra_worker_init.rb
|
208
|
+
- test/fixtures/js_file.js
|
209
|
+
- test/fixtures/json_data.json
|
210
|
+
- test/fixtures/many_outputs_to_console.rb
|
211
|
+
- test/fixtures/master_listeners.rb
|
212
|
+
- test/fixtures/runner_listeners.rb
|
213
|
+
- test/fixtures/slow.rb
|
214
|
+
- test/fixtures/sync_test.rb
|
215
|
+
- test/fixtures/task_test_config.yml
|
216
|
+
- test/fixtures/write_file.rb
|
217
|
+
- test/fixtures/write_file_alternate_spec.rb
|
218
|
+
- test/fixtures/write_file_spec.rb
|
219
|
+
- test/fixtures/write_file_with_pending_spec.rb
|
220
|
+
- test/master_test.rb
|
221
|
+
- test/message_test.rb
|
222
|
+
- test/pipe_test.rb
|
223
|
+
- test/runner_test.rb
|
224
|
+
- test/ssh_test.rb
|
225
|
+
- test/sync_test.rb
|
226
|
+
- test/task_test.rb
|
227
|
+
- test/test_helper.rb
|
228
|
+
- test/worker_test.rb
|
229
|
+
has_rdoc:
|