[Bps-public-commit] Prophet branch, master, updated. 8434be46f341c3ae05d9572f683ee296ccb723d5
spang at bestpractical.com
spang at bestpractical.com
Tue Aug 11 06:27:45 EDT 2009
The branch, master has been updated
via 8434be46f341c3ae05d9572f683ee296ccb723d5 (commit)
from 41b8b6a98eafa2b3347d9ed33bec341d6124c749 (commit)
Summary of changes:
lib/Prophet/Replica/sqlite.pm | 13 +++++++------
t/Settings/lib/App/Settings/Test.pm | 2 +-
t/Settings/t/database-settings-editor.t | 10 ++++------
t/real-conflicting-merge.t | 5 -----
t/simple-conflicting-merge.t | 4 ----
5 files changed, 12 insertions(+), 22 deletions(-)
- Log -----------------------------------------------------------------
commit 8434be46f341c3ae05d9572f683ee296ccb723d5
Author: Christine Spang <spang at bestpractical.com>
Date: Tue Aug 11 11:07:58 2009 +0100
Use replica uuid instead of db uuid to separate sqlite caching
diff --git a/lib/Prophet/Replica/sqlite.pm b/lib/Prophet/Replica/sqlite.pm
index 61972c3..0dad19c 100644
--- a/lib/Prophet/Replica/sqlite.pm
+++ b/lib/Prophet/Replica/sqlite.pm
@@ -102,33 +102,34 @@ sub has_cached_prop {
my $self = shift;
my $prop = shift;
- return exists $PROP_CACHE->{$self->db_uuid}->{$prop};
+ # $self->uuid is the replica's uuid
+ return exists $PROP_CACHE->{$self->uuid}->{$prop};
}
sub fetch_cached_prop {
my $self = shift;
my $prop = shift;
- return $PROP_CACHE->{$self->db_uuid}->{$prop};
+ return $PROP_CACHE->{$self->uuid}->{$prop};
}
sub set_cached_prop {
my $self = shift;
my ($prop, $value) = @_;
- $PROP_CACHE->{$self->db_uuid}->{$prop} = $value;
+ $PROP_CACHE->{$self->uuid}->{$prop} = $value;
}
sub delete_cached_prop {
my $self = shift;
my $prop = shift;
- delete $PROP_CACHE->{$self->db_uuid}->{$prop};
+ delete $PROP_CACHE->{$self->uuid}->{$prop};
}
sub clear_prop_cache {
- my $db_uuid = shift;
- delete $PROP_CACHE->{$db_uuid};
+ my $replica_uuid = shift;
+ delete $PROP_CACHE->{$replica_uuid};
}
use constant scheme => 'sqlite';
diff --git a/t/Settings/lib/App/Settings/Test.pm b/t/Settings/lib/App/Settings/Test.pm
index 3194dce..d221bd8 100644
--- a/t/Settings/lib/App/Settings/Test.pm
+++ b/t/Settings/lib/App/Settings/Test.pm
@@ -8,7 +8,7 @@ use lib 't/Settings/lib';
use App::Settings::CLI;
our @EXPORT = qw/as_alice as_bob diag run_command like ok
-repo_uri_for/;
+repo_uri_for replica_uuid/;
Prophet::Test->import;
diff --git a/t/Settings/t/database-settings-editor.t b/t/Settings/t/database-settings-editor.t
index d0cd7af..ccd7896 100644
--- a/t/Settings/t/database-settings-editor.t
+++ b/t/Settings/t/database-settings-editor.t
@@ -63,13 +63,11 @@ $valid_settings_output = Prophet::Util->slurp('t/data/settings-second.tmpl');
# look up db uuid and clear the prop cache, since we've modified the
# on-disk props via another process
-my ($db_uuid) = (run_command( 'info' ) =~ /DB UUID: (.*)\n/);
-Prophet::Replica::sqlite::clear_prop_cache( $db_uuid );
+my ($replica_uuid) = replica_uuid();
+Prophet::Replica::sqlite::clear_prop_cache( $replica_uuid );
-($out, my $error) = run_command( qw/settings show/ );
+$out = run_command( qw/settings show/ );
is( $out, $valid_settings_output, "changed settings output matches" );
-warn "going to print error of settings show";
-diag $error;
# test setting to invalid json
my $second_filename = File::Temp->new(
@@ -83,7 +81,7 @@ run_output_matches( 'settings', [ 'settings', 'edit' ],
], [], "interactive settings set with JSON error went ok",
);
-Prophet::Replica::sqlite::clear_prop_cache( $db_uuid );
+Prophet::Replica::sqlite::clear_prop_cache( $replica_uuid );
# check the tempfile to see if the template presented to the editor was correct
chomp($template_ok = Prophet::Util->slurp($filename));
diff --git a/t/real-conflicting-merge.t b/t/real-conflicting-merge.t
index 254dbfc..da2d8c5 100644
--- a/t/real-conflicting-merge.t
+++ b/t/real-conflicting-merge.t
@@ -69,11 +69,6 @@ as_bob {
my $conflict_obj;
- # XXX I am not entirely sure why we need to clear the cache here,
- # but we do
- my ($db_uuid) = (run_command( 'info' ) =~ /DB UUID: (.*)\n/);
- Prophet::Replica::sqlite::clear_prop_cache( $db_uuid );
-
throws_ok {
$target->import_changesets( from => $source, force => 1);
}
diff --git a/t/simple-conflicting-merge.t b/t/simple-conflicting-merge.t
index 118a5fe..08598c3 100644
--- a/t/simple-conflicting-merge.t
+++ b/t/simple-conflicting-merge.t
@@ -56,10 +56,6 @@ as_alice { $alice_app = Prophet::CLI->new()->app_handle; $alice = $alice_app->ha
as_alice {
- # XXX I am not entirely sure why we need to clear the cache here,
- # but we do
- my ($db_uuid) = (run_command( 'info' ) =~ /DB UUID: (.*)\n/);
- Prophet::Replica::sqlite::clear_prop_cache( $db_uuid );
ok( run_command(
'update', '--type', 'Bug', '--uuid',
$record_id, '--', '--status' => 'stalled',
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list