[Bps-public-commit] r16754 - in Prophet/branches/init-and-clone: . t
sartak at bestpractical.com
sartak at bestpractical.com
Sat Nov 8 00:16:12 EST 2008
Author: sartak
Date: Sat Nov 8 00:16:11 2008
New Revision: 16754
Added:
Prophet/branches/init-and-clone/t/init.t
Modified:
Prophet/branches/init-and-clone/ (props changed)
Prophet/branches/init-and-clone/lib/Prophet/Replica/prophet.pm
Log:
r75186 at onn: sartak | 2008-11-08 00:15:45 -0500
Throw an error when re-initializing a replica
Modified: Prophet/branches/init-and-clone/lib/Prophet/Replica/prophet.pm
==============================================================================
--- Prophet/branches/init-and-clone/lib/Prophet/Replica/prophet.pm (original)
+++ Prophet/branches/init-and-clone/lib/Prophet/Replica/prophet.pm Sat Nov 8 00:16:11 2008
@@ -285,6 +285,9 @@
}
}
+ die "The replica is already initialized.\n"
+ if $self->replica_exists;
+
dir( $self->fs_root, $_ )->mkpath
for (
$self->record_dir, $self->cas_root,
Added: Prophet/branches/init-and-clone/t/init.t
==============================================================================
--- (empty file)
+++ Prophet/branches/init-and-clone/t/init.t Sat Nov 8 00:16:11 2008
@@ -0,0 +1,24 @@
+use warnings;
+use strict;
+use Test::More tests => 4;
+use Test::Exception;
+
+use File::Temp qw'tempdir';
+
+use_ok('Prophet::CLI');
+$ENV{'PROPHET_REPO'} = tempdir( CLEANUP => 0 ) . '/repo-' . $$;
+my $cli = Prophet::CLI->new();
+my $cxn = $cli->handle;
+
+isa_ok( $cxn, 'Prophet::Replica', "Got the cxn" );
+
+lives_ok {
+ $cxn->initialize;
+} "initialize the connection";
+
+throws_ok {
+ $cxn->initialize;
+} qr/The replica is already initialized/, "attempting to reinitialize a replica throws an error";
+
+1;
+
More information about the Bps-public-commit
mailing list