[Bps-public-commit] r12270 - in TAP-Harness-Remote-EC2: . lib lib/TAP lib/TAP/Harness/Remote t

alexmv at bestpractical.com alexmv at bestpractical.com
Mon May 12 16:41:39 EDT 2008


Author: alexmv
Date: Mon May 12 16:41:39 2008
New Revision: 12270

Added:
   TAP-Harness-Remote-EC2/Build.PL
   TAP-Harness-Remote-EC2/Changes
   TAP-Harness-Remote-EC2/MANIFEST
   TAP-Harness-Remote-EC2/Makefile.PL
   TAP-Harness-Remote-EC2/README
   TAP-Harness-Remote-EC2/lib/
   TAP-Harness-Remote-EC2/lib/TAP/
   TAP-Harness-Remote-EC2/lib/TAP/Harness/
   TAP-Harness-Remote-EC2/lib/TAP/Harness/Remote/
   TAP-Harness-Remote-EC2/lib/TAP/Harness/Remote/EC2.pm
   TAP-Harness-Remote-EC2/t/
   TAP-Harness-Remote-EC2/t/00.load.t
   TAP-Harness-Remote-EC2/t/pod-coverage.t
   TAP-Harness-Remote-EC2/t/pod.t
Modified:
   TAP-Harness-Remote-EC2/   (props changed)

Log:
 r31572 at kohr-ah:  chmrr | 2008-05-12 16:41:28 -0400
  * Import 0.01


Added: TAP-Harness-Remote-EC2/Build.PL
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/Build.PL	Mon May 12 16:41:39 2008
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+    module_name         => 'TAP::Harness::Remote::EC2',
+    license             => 'perl',
+    dist_author         => 'Alex Vandiver <alexmv at bestpractical.com>',
+    dist_version_from   => 'lib/TAP/Harness/Remote/EC2.pm',
+    requires => {
+        'TAP::Harness' => 3.04,
+        'TAP::Harness::Remote' => 0,
+        'Net::Amazon::EC2' => 0,
+    },
+    add_to_cleanup      => [ 'TAP-Harness-Remote-EC2-*' ],
+);
+
+$builder->create_build_script();

Added: TAP-Harness-Remote-EC2/Changes
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/Changes	Mon May 12 16:41:39 2008
@@ -0,0 +1,5 @@
+Revision history for TAP-Harness-Remote-EC2
+
+0.01  Mon May 12 16:37:34 EDT 2008
+       Initial release.
+

Added: TAP-Harness-Remote-EC2/MANIFEST
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/MANIFEST	Mon May 12 16:41:39 2008
@@ -0,0 +1,9 @@
+Build.PL
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/TAP/Harness/Remote/EC2.pm
+t/00.load.t
+t/pod-coverage.t
+t/pod.t

Added: TAP-Harness-Remote-EC2/Makefile.PL
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/Makefile.PL	Mon May 12 16:41:39 2008
@@ -0,0 +1,13 @@
+use inc::Module::Install;
+
+name ('TAP-Harness-Remote-EC2');
+author ('Alex Vandiver <alexmv at bestpractical.com>');
+version_from ('lib/TAP/Harness/Remote/EC2.pm');
+abstract_from('lib/TAP/Harness/Remote/EC2.pm');
+license('perl');
+requires('Test::More');
+requires('TAP::Harness' => 3.04);
+requires('TAP::Harness::Remote');
+requires('Net::Amazon::EC2');
+auto_install();
+&WriteAll;

Added: TAP-Harness-Remote-EC2/README
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/README	Mon May 12 16:41:39 2008
@@ -0,0 +1,36 @@
+TAP-Harness-Remote-EC2 version 0.01
+
+Based on TAP::Harness::Remote, this module uses your running Amazon
+EC2 instances ( http://amazon.com/ec2 ) to run tests against, instead
+of a preconfigured list of hosts.
+
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+Alternatively, to install with Module::Build, you can use the following commands:
+
+	perl Build.PL
+	./Build
+	./Build test
+	./Build install
+
+
+DEPENDENCIES
+
+TAP::Harness::Remote, Net::Amazon::EC2
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2007-2008, Best Practical Solutions LLC.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+

Added: TAP-Harness-Remote-EC2/lib/TAP/Harness/Remote/EC2.pm
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/lib/TAP/Harness/Remote/EC2.pm	Mon May 12 16:41:39 2008
@@ -0,0 +1,147 @@
+package TAP::Harness::Remote::EC2;
+
+our $VERSION = '0.01';
+
+use warnings;
+use strict;
+
+use base 'TAP::Harness::Remote';
+use constant config_path => "$ENV{HOME}/.remote_test_ec2";
+use Net::Amazon::EC2;
+
+=head1 NAME
+
+TAP::Harness::Remote::EC2 - Run tests on EC2 servers
+
+=head1 SYNOPSIS
+
+    prove --harness TAP::Harness::Remote::EC2 t/*.t
+
+=head1 DESCRIPTION
+
+Based on L<TAP::Harness::Remote>, this module uses your running Amazon
+EC2 instances (L<http://amazon.com/ec2>) to run tests against, instead
+of a preconfigured list of hosts.
+
+=head1 USAGE
+
+Configuration is much the same as L<TAP::Harness::Remote>, except the
+configuration file lives in C</.remote_test_ec2> -- see
+L</"CONFIGURATION AND ENVIRONMENT">.  Note the
+L<TAP::Harness::Remote::EC2> does not, at current, start EC2 hosts
+itself, nor differentiate in any way between running EC2 hosts; it
+attempts to connect and run tests on all currently running EC2 hosts.
+
+=head1 METHODS
+
+=head2 load_remote_config
+
+Loads and canonicalizes the configuration.  Writes and uses the
+default configuration (L</default_config>) if the file does not exist.
+
+=cut
+
+sub load_remote_config {
+    my $self = shift;
+
+    $self->SUPER::load_remote_config;
+    warn
+        "Useless 'host' configuration parameter set for TAP::Harness::Remote::EC2\n"
+        if delete $self->remote_config("host");
+
+    die "Configuration failed to include required 'access_key' parameter\n"
+        unless $self->remote_config("access_key");
+
+    die
+        "Configuration failed to include required 'secret_access_key' parameter\n"
+        unless $self->remote_config("secret_access_key");
+
+    my $ec2 = Net::Amazon::EC2->new(
+        AWSAccessKeyId  => $self->remote_config("access_key"),
+        SecretAccessKey => $self->remote_config("secret_access_key"),
+    );
+
+    my $running_instances = $ec2->describe_instances;
+
+    my @hosts = map { $_->dns_name }
+        grep { $_->instance_state->name eq "running" }
+        map { @{ $_->instances_set } } @{$running_instances};
+
+    die "No EC2 hosts active\n" unless @hosts;
+    $self->{remote_config}{host} = \@hosts;
+    return $self;
+}
+
+=head1 CONFIGURATION AND ENVIRONMENT
+
+The configuration is stored in F<~/.remote_test_ec2>, and is mostly
+identical to the configuration of L<TAP::Harness::Remote> (see
+L<TAP::Harness::Remote/"CONFIGURATION AND ENVIRONMENT">), with the
+following differences:
+
+=over
+
+=item *
+
+The C<hosts> parameter is ignored, and produces a warning if present.
+
+=item *
+
+The C<access_key> amd C<secret_access_key> parameters are required, to
+be able to query the Amazon EC2 interface and determine the running
+EC2 hosts.  You can find your access keys at
+L<https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key>
+
+=back
+
+=head1 DEPENDENCIES
+
+L<Net::Amazon::EC2>
+
+=head1 BUGS AND LIMITATIONS
+
+The default perl installed Amazon's provided EC2 images is
+B<extremely> slow (about 4x slower than a clean, optimized build).  We
+thus strongly suggest you compile your own.
+
+In the future, L<TAP::Harness::Remote::EC2> may provide configuration
+options so that it can start and stop testing instances on demand.
+
+=head1 AUTHOR
+
+Alex Vandiver  C<< <alexmv at bestpractical.com> >>
+
+=head1 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 L<perlartistic>.
+
+=head1 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.
+
+=cut
+
+1;

Added: TAP-Harness-Remote-EC2/t/00.load.t
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/t/00.load.t	Mon May 12 16:41:39 2008
@@ -0,0 +1,7 @@
+use Test::More tests => 1;
+
+BEGIN {
+use_ok( 'TAP::Harness::Remote' );
+}
+
+diag( "Testing TAP::Harness::Remote $TAP::Harness::Remote::VERSION" );

Added: TAP-Harness-Remote-EC2/t/pod-coverage.t
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/t/pod-coverage.t	Mon May 12 16:41:39 2008
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: TAP-Harness-Remote-EC2/t/pod.t
==============================================================================
--- (empty file)
+++ TAP-Harness-Remote-EC2/t/pod.t	Mon May 12 16:41:39 2008
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();



More information about the Bps-public-commit mailing list