[Bps-public-commit] r11284 - in SVN-PropDB: . bin t
jesse at bestpractical.com
jesse at bestpractical.com
Sun Mar 30 21:35:06 EDT 2008
Author: jesse
Date: Sun Mar 30 21:35:06 2008
New Revision: 11284
Modified:
SVN-PropDB/ (props changed)
SVN-PropDB/bin/prophet-node-show
SVN-PropDB/bin/prophet-node-update
SVN-PropDB/lib/Prophet/Test.pm
SVN-PropDB/t/simple-conflicting-merge.t
Log:
r28821 at 70-5-79-37: jesse | 2008-03-30 15:34:53 -1000
* Everything short of handling a conflict runs
Modified: SVN-PropDB/bin/prophet-node-show
==============================================================================
--- SVN-PropDB/bin/prophet-node-show (original)
+++ SVN-PropDB/bin/prophet-node-show Sun Mar 30 21:35:06 2008
@@ -6,7 +6,6 @@
my $cli = Prophet::CLI->new();
$cli->parse_record_cmd_args();
my $record = Prophet::Record->new(handle => $cli->handle, type => $cli->type);
-warn "Loading ".$cli->uuid;
$record->load(uuid => $cli->uuid);
print "id: ".$record->uuid."\n";
my $props = $record->get_props();
Modified: SVN-PropDB/bin/prophet-node-update
==============================================================================
--- SVN-PropDB/bin/prophet-node-update (original)
+++ SVN-PropDB/bin/prophet-node-update Sun Mar 30 21:35:06 2008
@@ -7,6 +7,6 @@
$cli->parse_record_cmd_args();
my $record = Prophet::Record->new(handle => $cli->handle, type => $cli->type);
$record->load(uuid => $cli->uuid);
-$record->set_props(props => $prophet->args);
+$record->set_props(props => $cli->args);
warn "We want more feedback here";
Modified: SVN-PropDB/lib/Prophet/Test.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test.pm (original)
+++ SVN-PropDB/lib/Prophet/Test.pm Sun Mar 30 21:35:06 2008
@@ -72,8 +72,6 @@
my ($ret, $stdout,$stderr) = (run_script($script, $args), $msg);
@_ = ($ret);
- diag($stdout);
- diag($stderr);
goto &Test::More::ok;
};
goto \&lives_and;
Modified: SVN-PropDB/t/simple-conflicting-merge.t
==============================================================================
--- SVN-PropDB/t/simple-conflicting-merge.t (original)
+++ SVN-PropDB/t/simple-conflicting-merge.t Sun Mar 30 21:35:06 2008
@@ -3,115 +3,48 @@
use warnings;
use strict;
-use Prophet::Test tests => 25;
+use Prophet::Test tests => 9;
as_alice {
run_ok('prophet-node-create', [qw(--type Bug --status new --from alice )], "Created a record as alice");
run_output_matches('prophet-node-search', [qw(--type Bug --regex .)], [qr/new/], " Found our record");
- # update the node
- # show the node history
- # show the node
-};
+ };
-as_bob {
- run_ok('prophet-node-create', [qw(--type Bug --status open --from bob )], "Created a record as bob" );
- run_output_matches('prophet-node-search', [qw(--type Bug --regex .)], [qr/open/], " Found our record");
- # update the node
- # show the node history
- # show the node
+diag('Bob syncs from alice');
-};
+my $record_id;
-as_alice {
- # sync from bob
- diag('Alice syncs from bob');
- run_ok('prophet-merge', ['--from', repo_uri_for('bob'), '--to', repo_uri_for('alice')], "Sync ran ok!");
- # check our local replicas
- my ($ret, $out, $err) = run_script('prophet-node-search', [qw(--type Bug --regex .)]);
- like($out, qr/open/) ;
- like($out, qr/new/) ;
- my @out = split(/\n/,$out);
- is (scalar @out, 2, "We found only two rows of output");
-
- my $last_rev = replica_last_rev();
-
- diag('Alice syncs from bob again. There will be no new changes from bob');
-
- # sync from bob
- run_ok('prophet-merge', ['--from', repo_uri_for('bob'), '--to', repo_uri_for('alice')], "Sync ran ok!");
+as_bob {
+
+ run_ok('prophet-node-create', [qw(--type Dummy --ignore yes)], "Created a dummy record");
+
+ 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/) ;
- @out = split(/\n/,$out);
- is (scalar @out, 2, "We found only two rows of output");
-
- is(replica_last_rev() , $last_rev, "We have not recorded another transaction");
- is_deeply( replica_merge_tickets(), { replica_uuid_for('bob') => as_bob { replica_last_rev()} } );
-
+ my ($ret, $out, $err) = run_script('prophet-node-search', [qw(--type Bug --regex .)]);
+ like($out, qr/new/, "We have the one node from alice") ;
+ if ($out =~ /^(.*?)\s./) {
+ $record_id = $1;
+ }
+ diag($record_id);
+
+ run_ok('prophet-node-update', ['--type','Bug','--uuid',$record_id, '--status' => 'stalled']);
+ run_output_matches('prophet-node-show', ['--type', 'Bug', '--uuid', $record_id],
+ ['id: '.$record_id, 'status: stalled', 'from: alice'],
+ 'content is correct');
};
+as_alice {
+ run_ok('prophet-node-update', ['--type','Bug','--uuid',$record_id, '--status' => 'closed']);
+ my ($ret,$out,$err)= run_script('prophet-node-show', ['--type','Bug','--uuid',$record_id]);
+ diag($out);
-diag('Bob syncs from alice');
+};
as_bob {
- my $last_rev = replica_last_rev();
-
- 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 alice
-
+ # XXX TODO: this should actually fail right now.
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/) ;
- 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
-#
-# clone the replica to a second replica
-# compare the second replica to the first replica
-# search
-# node history
-# node basics
-#
-# update the first replica
-# merge the first replica to the second replica
-# does node history on the second replica reflect the first replica
-
-# merge the second replica to the first replica
-# ensure that no new transactions aside from a merge ticket are added to the first replica
-
-
-# update the second replica
-# merge the second replica to the first replica
-# make sure that the first replica has the change from the second replica
-#
-#
-# TODO: this doesn't test conflict resolution at all
-# TODO: this doesn't peer to peer sync at all
+
More information about the Bps-public-commit
mailing list