2010-01-20 17:00:59 +00:00
|
|
|
= Hydra
|
2010-01-20 16:58:56 +00:00
|
|
|
|
2010-02-07 00:56:37 +00:00
|
|
|
Spread your tests over multiple machines to test your code faster.
|
2010-01-20 16:58:56 +00:00
|
|
|
|
2010-02-07 00:56:37 +00:00
|
|
|
== Description
|
|
|
|
|
|
|
|
Hydra is a distributed testing framework. It allows you to distribute
|
|
|
|
your tests locally across multiple cores and processors, as well as
|
|
|
|
run your tests remotely over SSH.
|
|
|
|
|
|
|
|
Hydra's goals are to make distributed testing easy. So as long as
|
|
|
|
you can ssh into a computer and run the tests, you can automate
|
|
|
|
the distribution with Hydra.
|
|
|
|
|
|
|
|
== Usage
|
|
|
|
|
|
|
|
In your rakefile:
|
|
|
|
|
|
|
|
require 'hydra'
|
|
|
|
require 'hydra/tasks'
|
|
|
|
|
|
|
|
Hydra::TestTask.new('hydra') do |t|
|
|
|
|
t.add_files 'test/unit/**/*_test.rb'
|
|
|
|
t.add_files 'test/functional/**/*_test.rb'
|
|
|
|
t.add_files 'test/integration/**/*_test.rb'
|
|
|
|
end
|
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
Run:
|
|
|
|
|
|
|
|
$ rake hydra
|
|
|
|
|
|
|
|
Hydra defaults to Single Core mode, so you may want to configure it
|
|
|
|
to use two (or more) of your cores if you have a multi-processing machine.
|
2010-02-07 00:56:37 +00:00
|
|
|
|
2010-02-10 16:41:39 +00:00
|
|
|
== Running Remote Tasks
|
|
|
|
|
|
|
|
You can run tasks across all of your remote workers easily with Hydra. In your rake file, add:
|
|
|
|
|
|
|
|
Hydra::RemoteTask.new('db:reset')
|
|
|
|
|
|
|
|
Then you can run:
|
|
|
|
|
|
|
|
rake hydra:remote:db:reset
|
|
|
|
|
|
|
|
== Running Global Tasks
|
|
|
|
|
|
|
|
A Global task is a task run locally *and* remotely. It's used in the same way as RemoteTask:
|
|
|
|
|
|
|
|
Hydra::GlobalTask.new('db:reset')
|
|
|
|
|
|
|
|
But it is invoked in a higher namespace:
|
|
|
|
|
|
|
|
rake hydra:db:reset
|
|
|
|
|
2010-02-07 00:56:37 +00:00
|
|
|
== Configuration
|
|
|
|
|
|
|
|
Place the config file in the main project directory as
|
|
|
|
'hydra.yml' or 'config/hydra.yml'.
|
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
=== Examples
|
|
|
|
|
|
|
|
==== Dual Core
|
|
|
|
|
|
|
|
workers:
|
|
|
|
- type: local
|
|
|
|
runners: 2
|
|
|
|
|
|
|
|
==== Dual Core, with a remote Quad Core server
|
|
|
|
|
|
|
|
The -p3022 tells it to connect on a different port
|
|
|
|
|
2010-02-07 00:56:37 +00:00
|
|
|
workers:
|
|
|
|
- type: local
|
|
|
|
runners: 2
|
|
|
|
- type: ssh
|
2010-02-09 20:40:35 +00:00
|
|
|
connect: user@example.com
|
|
|
|
ssh_opts: -p3022
|
2010-02-07 00:56:37 +00:00
|
|
|
directory: /absolute/path/to/project
|
|
|
|
runners: 4
|
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
==== Two Remote Quad Cores with Synchronization
|
2010-02-07 00:56:37 +00:00
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
You can use the 'sync' configuration to allow rsync to synchronize
|
|
|
|
the local and remote directories every time you run hydra.
|
|
|
|
|
|
|
|
workers:
|
|
|
|
- type: ssh
|
|
|
|
connect: user@alpha.example.com
|
|
|
|
directory: /path/to/project/on/alpha/
|
|
|
|
runners: 4
|
|
|
|
- type: ssh
|
|
|
|
connect: user@beta.example.com
|
|
|
|
directory: /path/to/project/on/beta/
|
|
|
|
runners: 4
|
|
|
|
|
|
|
|
sync:
|
|
|
|
directory: /my/local/project/directory
|
|
|
|
exclude:
|
|
|
|
- tmp
|
|
|
|
- log
|
|
|
|
- doc
|
|
|
|
|
|
|
|
=== Workers Options
|
2010-02-07 00:56:37 +00:00
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
==== type
|
|
|
|
|
|
|
|
Either "local" or "ssh".
|
|
|
|
|
|
|
|
==== runners
|
|
|
|
|
|
|
|
The *runners* option is how many processes will be running
|
|
|
|
on the machine. It's best to pick the same number
|
2010-02-07 00:56:37 +00:00
|
|
|
as the number of cores on that machine (as well as your
|
|
|
|
own).
|
2010-01-20 16:58:56 +00:00
|
|
|
|
2010-02-09 20:40:35 +00:00
|
|
|
=== SSH Options
|
|
|
|
|
|
|
|
==== connect
|
|
|
|
|
|
|
|
The *connect* option is passed to SSH. So if you've setup an
|
|
|
|
ssh config alias to a server, you can use that. It is also
|
|
|
|
used in rsync, so you cannot use options.
|
|
|
|
|
|
|
|
==== ssh_opts
|
|
|
|
|
|
|
|
The *ssh_opts* option is passed to SSH and to Rsync's RSH so
|
|
|
|
that you can use the same ssh options for connecting and rsync.
|
|
|
|
Use ssh_opts to set the port or compression options.
|
|
|
|
|
|
|
|
==== directory
|
|
|
|
|
|
|
|
The *directory* option is the path for the project directory
|
|
|
|
where the tests should be run.
|
|
|
|
|
2010-02-10 16:44:18 +00:00
|
|
|
== More Information
|
|
|
|
|
|
|
|
For more information on Hydra, check out the rdocs:
|
|
|
|
|
|
|
|
http://rdoc.info/projects/ngauthier/hydra
|
|
|
|
|
2010-01-20 16:58:56 +00:00
|
|
|
== Copyright
|
|
|
|
|
|
|
|
Copyright (c) 2010 Nick Gauthier. See LICENSE for details.
|
2010-02-07 00:56:37 +00:00
|
|
|
|