Fix perl tests for sync journal db name

This commit is contained in:
Christian Kamm 2016-11-25 13:21:34 +01:00
parent 49f8143f00
commit 276985f6c3
4 changed files with 8 additions and 7 deletions

View file

@ -457,6 +457,7 @@ sub traverse( $$;$ )
$isHere = 1 if( $acceptConflicts && !$isHere && $f =~ /_conflict/ ); $isHere = 1 if( $acceptConflicts && !$isHere && $f =~ /_conflict/ );
$isHere = 1 if( $f =~ /\.csync/ ); $isHere = 1 if( $f =~ /\.csync/ );
$isHere = 1 if( $f =~ /\._sync_/ );
assert( $isHere, "Filename local, but not remote: $f" ); assert( $isHere, "Filename local, but not remote: $f" );
} }

View file

@ -176,7 +176,7 @@ assertLocalAndRemoteDir( 'remoteToLocal1', 1);
printInfo("simulate a owncloud 5 update by removing all the fileid"); printInfo("simulate a owncloud 5 update by removing all the fileid");
## simulate a owncloud 5 update by removing all the fileid ## simulate a owncloud 5 update by removing all the fileid
system( "sqlite3 " . localDir() . ".csync_journal.db \"UPDATE metadata SET fileid='';\""); system( "sqlite3 " . localDir() . "._sync_*.db \"UPDATE metadata SET fileid='';\"");
#refresh the ids #refresh the ids
csync(); csync();
assertLocalAndRemoteDir( 'remoteToLocal1', 1); assertLocalAndRemoteDir( 'remoteToLocal1', 1);

View file

@ -61,7 +61,7 @@ sub getETagFromJournal($$)
{ {
my ($name,$num) = @_; my ($name,$num) = @_;
my $sql = "sqlite3 " . localDir() . ".csync_journal.db \"SELECT md5 FROM metadata WHERE path='$name';\""; my $sql = "sqlite3 " . localDir() . "._sync_*.db \"SELECT md5 FROM metadata WHERE path='$name';\"";
open(my $fh, '-|', $sql) or die $!; open(my $fh, '-|', $sql) or die $!;
my $etag = <$fh>; my $etag = <$fh>;
close $fh; close $fh;

View file

@ -37,8 +37,8 @@ sub assertCsyncJournalOk {
my $path = $_[0]; my $path = $_[0];
# FIXME: should test also remoteperm but it's not working with owncloud6 # FIXME: should test also remoteperm but it's not working with owncloud6
# my $cmd = 'sqlite3 ' . $path . '.csync_journal.db "SELECT count(*) from metadata where length(remotePerm) == 0 or length(fileId) == 0"'; # my $cmd = 'sqlite3 ' . $path . '._sync_*.db "SELECT count(*) from metadata where length(remotePerm) == 0 or length(fileId) == 0"';
my $cmd = 'sqlite3 ' . $path . '.csync_journal.db "SELECT count(*) from metadata where length(fileId) == 0"'; my $cmd = 'sqlite3 ' . $path . '._sync_*.db "SELECT count(*) from metadata where length(fileId) == 0"';
my $result = `$cmd`; my $result = `$cmd`;
assert($result == "0"); assert($result == "0");
} }
@ -170,14 +170,14 @@ assertLocalAndRemoteDir( '', 0);
####################################################################### #######################################################################
printInfo( "move a directory in a outside read only folder" ); printInfo( "move a directory in a outside read only folder" );
system("sqlite3 " . localDir().'.csync_journal.db .dump'); system("sqlite3 " . localDir().'._sync_*.db .dump');
#Missing directory should be restored #Missing directory should be restored
#new directory should be uploaded #new directory should be uploaded
system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_' ); system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_' );
csync(); csync();
system("sqlite3 " . localDir().'.csync_journal.db .dump'); system("sqlite3 " . localDir().'._sync_*.db .dump');
assertCsyncJournalOk(localDir()); assertCsyncJournalOk(localDir());
# old name restored # old name restored
@ -229,7 +229,7 @@ system("rm -r " . localDir(). "readonlyDirectory_PERM_M_/moved_PERM_CK_");
assertLocalAndRemoteDir( '', 0); assertLocalAndRemoteDir( '', 0);
system("sqlite3 " . localDir().'.csync_journal.db .dump'); system("sqlite3 " . localDir().'._sync_*.db .dump');
####################################################################### #######################################################################