hydra 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +50 -2
- data/VERSION +1 -1
- data/hydra.gemspec +5 -4
- data/lib/hydra/tasks.rb +76 -0
- data/lib/hydra/worker.rb +1 -0
- data/test/fixtures/hello_world.rb +3 -0
- data/test/ssh_test.rb +3 -4
- metadata +5 -4
- data/test/fixtures/echo_the_dolphin.rb +0 -7
data/README.rdoc
CHANGED
@@ -1,9 +1,57 @@
|
|
1
1
|
= Hydra
|
2
2
|
|
3
|
-
|
3
|
+
Spread your tests over multiple machines to test your code faster.
|
4
4
|
|
5
|
-
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Hydra is a distributed testing framework. It allows you to distribute
|
8
|
+
your tests locally across multiple cores and processors, as well as
|
9
|
+
run your tests remotely over SSH.
|
10
|
+
|
11
|
+
Hydra's goals are to make distributed testing easy. So as long as
|
12
|
+
you can ssh into a computer and run the tests, you can automate
|
13
|
+
the distribution with Hydra.
|
14
|
+
|
15
|
+
== Usage
|
16
|
+
|
17
|
+
In your rakefile:
|
18
|
+
|
19
|
+
require 'hydra'
|
20
|
+
require 'hydra/tasks'
|
21
|
+
|
22
|
+
Hydra::TestTask.new('hydra') do |t|
|
23
|
+
t.add_files 'test/unit/**/*_test.rb'
|
24
|
+
t.add_files 'test/functional/**/*_test.rb'
|
25
|
+
t.add_files 'test/integration/**/*_test.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
Then you can run 'rake hydra'.
|
29
|
+
|
30
|
+
== Configuration
|
31
|
+
|
32
|
+
Place the config file in the main project directory as
|
33
|
+
'hydra.yml' or 'config/hydra.yml'.
|
34
|
+
|
35
|
+
workers:
|
36
|
+
- type: local
|
37
|
+
runners: 2
|
38
|
+
- type: ssh
|
39
|
+
connect: user@example.com -p3022
|
40
|
+
directory: /absolute/path/to/project
|
41
|
+
runners: 4
|
42
|
+
|
43
|
+
The "connect" option is passed to SSH. So if you've setup an
|
44
|
+
ssh config alias to a server, you can use that.
|
45
|
+
|
46
|
+
The "directory" option is the path for the project directory
|
47
|
+
where the tests should be run.
|
48
|
+
|
49
|
+
The "runners" option is how many processes will be running
|
50
|
+
on the remote machine. It's best to pick the same number
|
51
|
+
as the number of cores on that machine (as well as your
|
52
|
+
own).
|
6
53
|
|
7
54
|
== Copyright
|
8
55
|
|
9
56
|
Copyright (c) 2010 Nick Gauthier. See LICENSE for details.
|
57
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/hydra.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hydra}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nick Gauthier"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-06}
|
13
13
|
s.description = %q{Spread your tests over multiple machines to test your code faster.}
|
14
14
|
s.email = %q{nick@smartlogicsolutions.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,11 +40,12 @@ Gem::Specification.new do |s|
|
|
40
40
|
"lib/hydra/safe_fork.rb",
|
41
41
|
"lib/hydra/ssh.rb",
|
42
42
|
"lib/hydra/stdio.rb",
|
43
|
+
"lib/hydra/tasks.rb",
|
43
44
|
"lib/hydra/trace.rb",
|
44
45
|
"lib/hydra/worker.rb",
|
45
46
|
"test/fixtures/assert_true.rb",
|
46
47
|
"test/fixtures/config.yml",
|
47
|
-
"test/fixtures/
|
48
|
+
"test/fixtures/hello_world.rb",
|
48
49
|
"test/fixtures/slow.rb",
|
49
50
|
"test/fixtures/write_file.rb",
|
50
51
|
"test/master_test.rb",
|
@@ -67,7 +68,7 @@ Gem::Specification.new do |s|
|
|
67
68
|
"test/fixtures/write_file.rb",
|
68
69
|
"test/fixtures/slow.rb",
|
69
70
|
"test/fixtures/assert_true.rb",
|
70
|
-
"test/fixtures/
|
71
|
+
"test/fixtures/hello_world.rb",
|
71
72
|
"test/master_test.rb",
|
72
73
|
"test/worker_test.rb",
|
73
74
|
"test/runner_test.rb",
|
data/lib/hydra/tasks.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
module Hydra #:nodoc:
|
2
|
+
# Define a test task that uses hydra to test the files.
|
3
|
+
#
|
4
|
+
# TODO: examples
|
5
|
+
class TestTask
|
6
|
+
# Name of the task. Default 'hydra'
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
# Files to test.
|
10
|
+
# You can add files manually via:
|
11
|
+
# t.files << [file1, file2, etc]
|
12
|
+
#
|
13
|
+
# Or you can use the add_files method
|
14
|
+
attr_accessor :files
|
15
|
+
|
16
|
+
# True if you want to see Hydra's message traces
|
17
|
+
attr_accessor :verbose
|
18
|
+
|
19
|
+
# Path to the hydra config file.
|
20
|
+
# If not set, it will check 'hydra.yml' and 'config/hydra.yml'
|
21
|
+
attr_accessor :config
|
22
|
+
|
23
|
+
# Create a new HydraTestTask
|
24
|
+
def initialize(name = :hydra)
|
25
|
+
@name = name
|
26
|
+
@files = []
|
27
|
+
@verbose = false
|
28
|
+
|
29
|
+
yield self if block_given?
|
30
|
+
|
31
|
+
@config = find_config_file
|
32
|
+
|
33
|
+
@opts = {
|
34
|
+
:verbose => @verbose,
|
35
|
+
:files => @files
|
36
|
+
}
|
37
|
+
if @config
|
38
|
+
@opts.merge!(:config => @config)
|
39
|
+
else
|
40
|
+
$stderr.write "Hydra: No configuration file found at 'hydra.yml' or 'config/hydra.yml'\n"
|
41
|
+
$stderr.write "Hydra: Using default configuration for a single-core machine\n"
|
42
|
+
@opts.merge!(:workers => [{:type => :local, :runners => 1}])
|
43
|
+
end
|
44
|
+
|
45
|
+
define
|
46
|
+
end
|
47
|
+
|
48
|
+
# Create the rake task defined by this HydraTestTask
|
49
|
+
def define
|
50
|
+
desc "Hydra Tests" + (@name == :hydra ? "" : " for #{@name}")
|
51
|
+
task @name do
|
52
|
+
$stdout.write "Hydra Testing #{files.inspect}\n"
|
53
|
+
Hydra::Master.new(@opts)
|
54
|
+
$stdout.write "\nHydra Completed\n"
|
55
|
+
exit(0) #bypass test on_exit output
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Add files to test by passing in a string to be run through Dir.glob.
|
60
|
+
# For example:
|
61
|
+
#
|
62
|
+
# t.add_files 'test/units/*.rb'
|
63
|
+
def add_files(pattern)
|
64
|
+
@files += Dir.glob(pattern)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Search for the hydra config file
|
68
|
+
def find_config_file
|
69
|
+
@config ||= 'hydra.yml'
|
70
|
+
return @config if File.exists?(@config)
|
71
|
+
@config = File.join('config', 'hydra.yml')
|
72
|
+
return @config if File.exists?(@config)
|
73
|
+
@config = nil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/hydra/worker.rb
CHANGED
data/test/ssh_test.rb
CHANGED
@@ -5,11 +5,10 @@ class SSHTest < Test::Unit::TestCase
|
|
5
5
|
ssh = Hydra::SSH.new(
|
6
6
|
'localhost', # connect to this machine
|
7
7
|
File.expand_path(File.join(File.dirname(__FILE__))), # move to the test directory
|
8
|
-
"ruby fixtures/
|
8
|
+
"ruby fixtures/hello_world.rb"
|
9
9
|
)
|
10
|
-
|
11
|
-
|
12
|
-
assert_equal message.text, ssh.gets.text
|
10
|
+
response = ssh.gets
|
11
|
+
assert_equal "Hello World", response.text
|
13
12
|
ssh.close
|
14
13
|
end
|
15
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Gauthier
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-06 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -65,11 +65,12 @@ files:
|
|
65
65
|
- lib/hydra/safe_fork.rb
|
66
66
|
- lib/hydra/ssh.rb
|
67
67
|
- lib/hydra/stdio.rb
|
68
|
+
- lib/hydra/tasks.rb
|
68
69
|
- lib/hydra/trace.rb
|
69
70
|
- lib/hydra/worker.rb
|
70
71
|
- test/fixtures/assert_true.rb
|
71
72
|
- test/fixtures/config.yml
|
72
|
-
- test/fixtures/
|
73
|
+
- test/fixtures/hello_world.rb
|
73
74
|
- test/fixtures/slow.rb
|
74
75
|
- test/fixtures/write_file.rb
|
75
76
|
- test/master_test.rb
|
@@ -114,7 +115,7 @@ test_files:
|
|
114
115
|
- test/fixtures/write_file.rb
|
115
116
|
- test/fixtures/slow.rb
|
116
117
|
- test/fixtures/assert_true.rb
|
117
|
-
- test/fixtures/
|
118
|
+
- test/fixtures/hello_world.rb
|
118
119
|
- test/master_test.rb
|
119
120
|
- test/worker_test.rb
|
120
121
|
- test/runner_test.rb
|