Alex Vandiver > TAP-Harness-Remote-0.02 > TAP::Harness::Remote

Download:
TAP-Harness-Remote-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.02   Source   Latest Release: TAP-Harness-Remote-1.10

NAME ^

TAP::Harness::Remote - Run tests on a remote server

SYNOPSIS ^

    prove -l --state=save,slow --harness TAP::Harness::Remote t/*.t

DESCRIPTION ^

Sometimes you want to run tests on a remote testing machine, rather than your local development box. TAP::Harness::Remote allows you so reproduce entire directory trees on a remote server via rsync, and spawn the tests remotely. It also supports round-robin distribution of tests across multiple remote testing machines.

USAGE ^

TAP::Harness::Remote synchronizes a local directory to the remote testing server. All tests that you wish to run remotely must be somewhere within this "local testing root" directory. You should configure where this directory is by creating or editing your ~/.remote_test file:

    ---
    ssh: /usr/bin/ssh
    local: /path/to/local/testing/root/
    user: username
    host: remote.testing.host.example.com
    root: /where/to/place/local/root/on/remote/
    perl: /usr/bin/perl
    master: 1
    ssh_args:
      - -x
      - -S
      - '~/.ssh/master-%r@%h:%p'

See "CONFIGURATION AND ENVIRONMENT" for more details on the individual configuration options.

Once your ~/.remote_test is configured, you can run your tests remotely, using:

    prove -l --harness TAP::Harness::Remote t/*.t

Any paths in @INC which point inside your local testing root are rewritten to point to the equivilent path on the remote host. This is especially useful if you are testing a number of inter-related modules; by placing all of them all under the local testing root, and adding all of their lib/ paths to your PERL5LIB, you can ensure that the remote machine always tests your combination of the modules, not whichever versions are installed on the remote host.

Note that for irritating technical reasons (your CWD has already been resolved), your local root cannot contain symlinks to directories. This means you may need to rearrange your directory structure slightly to set up the appropriate local testing root.

If you farm of remote hosts, you may change the host configuration variable to be an array reference of hostnames. Tests will be distributed in a round-robin manner across the hosts. Each host will run as many tests in parallel as you specified with -j.

Especially when running tests in parallel, it is highly suggested that you use the standard TAP::Harness --state=save,slow option, as this ensures that the slowest tests will run first, reducing your overall test run time.

METHODS ^

new

Overrides "new" in TAP::Harness to load the local configuration, and add the necessary hooks for when tests are actually run.

config_path

Returns the path to the configuration file; this is usually $ENV{HOME}/.remote_test.

default_config

Returns, as a hashref, the default configuration. See "CONFIGURATION".

load_remote_config

Loads and canonicalizes the configuration. Writes and uses the default configuration ("default_config") if the file does not exist.

remote_config KEY

Returns the configuration value set fo the given KEY.

userhost [HOST]

Returns a valid user@host string; host is taken to be the first known host, unless provided.

start_masters

Starts the ssh master connections, if support for them is enabled. Otherwise, does nothing. See the man page for ssh -M for more information about master connections.

rsync

Starts the openssh master connections if need be (see "start_masters"), then rsync's over the entire local root. Additionally, rewrites the local PERL5LIB path such that any directories which point into the local root are included in the remote PERL5LIB as well.

DESTROY

Tears down the ssh master connections, if they were started.

change_switches

Changes the switches around, such that the remote perl is called, via ssh.

CONFIGURATION AND ENVIRONMENT ^

Configuration is done via the file ~/.remote_test, which is a YAML file. Valid keys are:

user

The username to use on the remote connection.

host

The host to connect to. If this is an array reference, tests will be distributed, round-robin fashion, across all of the hosts. This does also incur the overhead of rsync'ing to each host.

root

The remote testing root. This is the place where the local root will be rsync'd to.

local

The local testing root. All files under this will be rsync'd to the remote server. All tests to be run remotely must be within this root.

perl

The path to the perl binary on the remote host.

ssh

The path to the local ssh binary.

ssh_args

Either a string or an array reference of arguments to pass to ssh. Suggested defaults include -x and -S ~/.ssh/master-%r@%h:%p

master

If a true value is given for this, will attempt to use OpenSSH master connections to reduce the overhead of making repeated connections to the remote host.

DEPENDENCIES ^

A recent enough TAP::Harness build; 3.03 or later should suffice. Working copies of OpenSSH and rsync.

BUGS AND LIMITATIONS ^

Aborting tests using ^C may leave dangling processes on the remote host.

Please report any bugs or feature requests to bug-tap-harness-remote@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR ^

Alex Vandiver <alexmv@bestpractical.com>

LICENCE AND COPYRIGHT ^

Copyright (c) 2007-2008, Best Practical Solutions, LLC. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.