[Bps-public-commit] r11385 - in SVN-PropDB: . bin
jesse at bestpractical.com
jesse at bestpractical.com
Wed Apr 2 05:07:29 EDT 2008
Author: jesse
Date: Wed Apr 2 05:07:23 2008
New Revision: 11385
Modified:
SVN-PropDB/ (props changed)
SVN-PropDB/bin/generalized_sync_n_merge.t
SVN-PropDB/lib/Prophet/Test/Arena.pm
SVN-PropDB/lib/Prophet/Test/Participant.pm
Log:
r28978 at 31b: jesse | 2008-04-01 23:03:56 -1000
* small improvements to our chicken arena testing
Modified: SVN-PropDB/bin/generalized_sync_n_merge.t
==============================================================================
--- SVN-PropDB/bin/generalized_sync_n_merge.t (original)
+++ SVN-PropDB/bin/generalized_sync_n_merge.t Wed Apr 2 05:07:23 2008
@@ -9,12 +9,12 @@
my $arena = Prophet::Test::Arena->new();
$arena->setup(shift || 5);
-
-for(1..3) {
+eval {
+for(1) {
$arena->step('create_record');
}
-for(1..5) {
+for(1..10) {
$arena->step();
}
@@ -26,11 +26,13 @@
$arena->sync_all_pairs;
# dump all chickens to a datastructure and compare to the previous rev
my $fourth = $arena->dump_state;
-
is_deeply($third,$fourth);
+};
+my $err = $@;
+ok(!$err, "There was no error ($err)");
my $Test = Test::Builder->new;
if (grep { !$_ } $Test->summary) {
- my $fname = join('-', sort map { $_->name } @{$arena->chickens}).'.yml';
+ my $fname = join('', sort map { substr($_->name,0,1)} @{$arena->chickens}).'.yml';
diag "test failed... dumping recipe to $fname";
YAML::Syck::DumpFile( $fname,
{ chickens => [ map { $_->name } @{ $arena->chickens } ],
Modified: SVN-PropDB/lib/Prophet/Test/Arena.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Arena.pm (original)
+++ SVN-PropDB/lib/Prophet/Test/Arena.pm Wed Apr 2 05:07:23 2008
@@ -71,11 +71,15 @@
}
}
+ my $TB = Test::Builder->new();
sub step {
my $self = shift;
my $step_name = shift || undef;
for my $chicken (@{$self->chickens}) {
as_user($chicken->name, sub {$chicken->take_one_step($step_name)});
+ die if (grep { !$_ } $TB->summary);
+
+
}
# for x rounds, have each participant execute a random action
@@ -97,23 +101,19 @@
diag("now syncing all pairs");
- my @chickens_a = shuffle @{$self->chickens};
- my @chickens_b = shuffle @{$self->chickens};
-
- my %seen_pairs;
+ my @chickens_a = shuffle @{ $self->chickens };
+ my @chickens_b = shuffle @{ $self->chickens };
foreach my $a (@chickens_a) {
- foreach my $b (@chickens_b) {
- next if $a->name eq $b->name;
- next if ($seen_pairs{$b->name."-".$a->name});
- diag($a->name, $b->name);
- as_user($a->name, sub {$a->sync_from_peer({ from => $b->name }) });
- $seen_pairs{$a->name."-".$b->name} =1;
- }
+ foreach my $b (@chickens_b) {
+ next if $a->name eq $b->name;
+ diag( $a->name, $b->name );
+ as_user( $a->name, sub { $a->sync_from_peer( { from => $b->name } ) } );
+ die if (grep { !$_ } $TB->summary);
+ }
}
-
-
+ return 1;
}
sub record {
Modified: SVN-PropDB/lib/Prophet/Test/Participant.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Participant.pm (original)
+++ SVN-PropDB/lib/Prophet/Test/Participant.pm Wed Apr 2 05:07:23 2008
@@ -100,6 +100,10 @@
my $args = shift;
$args->{record} ||= get_random_local_record();
+ unless($args->{'record'}) {
+ ok(0,"The user didn't have a record in their db - ".$ENV{'PROPHET_USER'}) ;
+ return;
+ }
my ($ok, $stdout, $stderr) = run_script('prophet-node-show', [qw(--type Scratch --uuid), $args->{record}]);
my %props = map { split(/: /,$_,2) } split(/\n/,$stdout);
More information about the Bps-public-commit
mailing list