[Bps-public-commit] r11280 - in SVN-PropDB: . doc t

jesse at bestpractical.com jesse at bestpractical.com
Sun Mar 30 20:44:06 EDT 2008


Author: jesse
Date: Sun Mar 30 20:44:06 2008
New Revision: 11280

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/doc/todo
   SVN-PropDB/lib/Prophet/Test.pm
   SVN-PropDB/t/cli.t

Log:
 r28812 at 70-5-79-37:  jesse | 2008-03-30 14:42:38 -1000
  quiet tests in nonverbose mode, update todo


Modified: SVN-PropDB/doc/todo
==============================================================================
--- SVN-PropDB/doc/todo	(original)
+++ SVN-PropDB/doc/todo	Sun Mar 30 20:44:06 2008
@@ -2,7 +2,6 @@
 
 Todo
 
-- ability to pull non-conflicting updates from a remote db
 - implement merge of conflicts with: "local always wins"
 - prompt for resolution of conflicts
 - record conflict resolution data 
@@ -24,4 +23,5 @@
         - sequence_no from the original recording source
 
 - naive support for large attachments
+- ability to pull non-conflicting updates from a remote db
 

Modified: SVN-PropDB/lib/Prophet/Test.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test.pm	Sun Mar 30 20:44:06 2008
@@ -2,7 +2,7 @@
 use warnings;
 package Prophet::Test;
 use base qw/Test::More Exporter/;
-our @EXPORT = qw/as_alice as_bob as_charlie as_david run_ok repo_uri_for run_script run_output_matches replica_last_rev replica_merge_tickets replica_uuid_for/;
+our @EXPORT = qw/diag as_alice as_bob as_charlie as_david run_ok repo_uri_for run_script run_output_matches replica_last_rev replica_merge_tickets replica_uuid_for/;
 
 use File::Path 'rmtree';
 use File::Temp qw/tempdir/;
@@ -31,6 +31,13 @@
     }
 }
 
+
+*old_diag = \&Test::More::diag;
+{ no warnings 'redefine';
+sub Test::More::diag { # bad bad bad # convenient convenient convenient
+ old_diag(@_) if $ENV{'TEST_VERBOSE'};
+}
+}
 =head2 run_script SCRIPT_NAME [@ARGS]
 
 Runs the script SCRIPT_NAME as a perl script, setting the @INC to the same as our caller

Modified: SVN-PropDB/t/cli.t
==============================================================================
--- SVN-PropDB/t/cli.t	(original)
+++ SVN-PropDB/t/cli.t	Sun Mar 30 20:44:06 2008
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Prophet::Test tests => 19;
+use Prophet::Test tests => 25;
 
 as_alice {
     run_ok('prophet-node-create', [qw(--type Bug --status new --from alice )], "Created a record as alice"); 
@@ -61,16 +61,35 @@
     my ($ret, $out, $err) = run_script('prophet-node-search', [qw(--type Bug --regex .)]);
     unlike($out, qr/new/, "bob doesn't have alice's yet") ;
 
-    # sync from bob
+    # sync from alice
+    
     run_ok('prophet-merge', ['--to', repo_uri_for('bob'), '--from', repo_uri_for('alice')], "Sync ran ok!");
     # check our local replicas
     ($ret, $out, $err) = run_script('prophet-node-search', [qw(--type Bug --regex .)]);
     like($out, qr/open/) ;
     like($out, qr/new/) ;
-    system("svn log -v ".repo_uri_for("bob"));
     is( replica_last_rev, $last_rev + 1, "only one rev from alice is sycned" );
+    # last rev of alice is originated from bob (us), so not synced to bob, hence the merge ticket is at the previous rev.
+    is_deeply( replica_merge_tickets(), { replica_uuid_for('alice') => as_alice { replica_last_rev() - 1 }  } );
+     $last_rev = replica_last_rev();
+
+    
+    
+    diag('Sync from alice to bob again');
+    run_ok('prophet-merge', ['--to', repo_uri_for('bob'), '--from', repo_uri_for('alice')], "Sync ran ok!");
+
+    is_deeply( replica_merge_tickets(), { replica_uuid_for('alice') => as_alice { replica_last_rev() - 1 }  });
+    is(replica_last_rev() , $last_rev, "We have not recorded another transaction after a second sync");
+
 };
 
+as_alice {
+    my $last_rev = replica_last_rev();
+    run_ok('prophet-merge', ['--to', repo_uri_for('alice'), '--from', repo_uri_for('bob')], "Sync ran ok!");
+    is(replica_last_rev() , $last_rev, "We have not recorded another transaction after bob had fully synced from alice");
+
+}
+
 
 # create 1 node
 # search for the node



More information about the Bps-public-commit mailing list