def tst_cp(self): tempdir = tempfile.mkdtemp(prefix='s3ql-cp-') try: populate_dir(tempdir) # Rsync subprocess.check_call(['rsync', '-aHAX', tempdir + '/', os.path.join(self.mnt_dir, 'orig') + '/']) # copy subprocess.check_call(self.s3ql_cmd_argv('s3qlcp') + [ '--quiet', os.path.join(self.mnt_dir, 'orig'), os.path.join(self.mnt_dir, 'copy')]) # compare try: out = check_output(['rsync', '-anciHAX', '--delete', tempdir + '/', os.path.join(self.mnt_dir, 'copy') + '/'], universal_newlines=True, stderr=subprocess.STDOUT) except CalledProcessError as exc: pytest.fail('rsync failed with ' + exc.output) if out: pytest.fail('Copy not equal to original, rsync says:\n' + out) finally: shutil.rmtree(tempdir)
def tst_cp(self): tempdir = tempfile.mkdtemp(prefix="s3ql-cp-") try: populate_dir(tempdir) # Rsync subprocess.check_call(["rsync", "-aHAX", tempdir + "/", os.path.join(self.mnt_dir, "orig") + "/"]) # copy subprocess.check_call( self.s3ql_cmd_argv("s3qlcp") + ["--quiet", os.path.join(self.mnt_dir, "orig"), os.path.join(self.mnt_dir, "copy")] ) # compare try: out = check_output( ["rsync", "-anciHAX", "--delete", tempdir + "/", os.path.join(self.mnt_dir, "copy") + "/"], universal_newlines=True, stderr=subprocess.STDOUT, ) except CalledProcessError as exc: pytest.fail("rsync failed with " + exc.output) if out: pytest.fail("Copy not equal to original, rsync says:\n" + out) finally: shutil.rmtree(tempdir)
def runTest(self): populate_dir(self.ref_dir) # Create and mount using previous S3QL version self.mkfs_old() self.mount_old() subprocess.check_call( ['rsync', '-aHAX', self.ref_dir + '/', self.mnt_dir + '/']) self.umount_old() # Copy old bucket shutil.copytree(self.backend_dir, os.path.join(self.bak_dir, 'copy'), symlinks=True) # Upgrade and compare with cache self.upgrade() self.compare() # Upgrade and compare without cache shutil.rmtree(self.backend_dir) shutil.rmtree(self.cache_dir) self.cache_dir = tempfile.mkdtemp(prefix='s3ql-cache-') shutil.copytree(os.path.join(self.bak_dir, 'copy'), self.backend_dir, symlinks=True) self.upgrade() self.compare()
def runTest(self): populate_dir(self.ref_dir) # Create and mount using previous S3QL version self.mkfs_old() self.mount_old() subprocess.check_call(['rsync', '-aHAX', self.ref_dir + '/', self.mnt_dir + '/']) self.umount_old() # Copy old bucket shutil.copytree(self.backend_dir, os.path.join(self.bak_dir, 'copy'), symlinks=True) # Upgrade and compare with cache self.upgrade() self.compare() # Upgrade and compare without cache shutil.rmtree(self.backend_dir) shutil.rmtree(self.cache_dir) self.cache_dir = tempfile.mkdtemp(prefix='s3ql-cache-') shutil.copytree(os.path.join(self.bak_dir, 'copy'), self.backend_dir, symlinks=True) self.upgrade() self.compare()
def runTest(self): skip_without_rsync() ref_dir = tempfile.mkdtemp(prefix='s3ql-ref-') try: populate_dir(ref_dir) # Make file system and fake high inode number self.mkfs() db = Connection( get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') db.execute('UPDATE sqlite_sequence SET seq=? WHERE name=?', (2**31 + 10, 'inodes')) db.close() # Copy source data self.mount() subprocess.check_call( ['rsync', '-aHAX', ref_dir + '/', self.mnt_dir + '/']) self.umount() # Check that inode watermark is high db = Connection( get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') self.assertGreater( db.get_val('SELECT seq FROM sqlite_sequence WHERE name=?', ('inodes', )), 2**31 + 10) self.assertGreater(db.get_val('SELECT MAX(id) FROM inodes'), 2**31 + 10) db.close() # Renumber inodes self.fsck() # Check if renumbering was done db = Connection( get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') self.assertLess( db.get_val('SELECT seq FROM sqlite_sequence WHERE name=?', ('inodes', )), 2**31) self.assertLess(db.get_val('SELECT MAX(id) FROM inodes'), 2**31) db.close() # Compare self.mount() try: out = check_output([ 'rsync', '-anciHAX', '--delete', '--exclude', '/lost+found', ref_dir + '/', self.mnt_dir + '/' ], universal_newlines=True, stderr=subprocess.STDOUT) except CalledProcessError as exc: self.fail('rsync failed with ' + exc.output) if out: self.fail('Copy not equal to original, rsync says:\n' + out) self.umount() finally: shutil.rmtree(ref_dir)
def test(self): skip_without_rsync() ref_dir = tempfile.mkdtemp(prefix='s3ql-ref-') try: populate_dir(ref_dir) # Make file system and fake high inode number self.mkfs() db = Connection(get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') db.execute('UPDATE sqlite_sequence SET seq=? WHERE name=?', (2 ** 31 + 10, 'inodes')) db.close() # Copy source data self.mount() subprocess.check_call(['rsync', '-aHAX', ref_dir + '/', self.mnt_dir + '/']) self.umount() # Check that inode watermark is high db = Connection(get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') assert db.get_val('SELECT seq FROM sqlite_sequence WHERE name=?', ('inodes',)) > 2 ** 31 + 10 assert db.get_val('SELECT MAX(id) FROM inodes') > 2 ** 31 + 10 db.close() # Renumber inodes self.fsck() # Check if renumbering was done db = Connection(get_backend_cachedir(self.storage_url, self.cache_dir) + '.db') assert db.get_val('SELECT seq FROM sqlite_sequence WHERE name=?', ('inodes',)) < 2 ** 31 assert db.get_val('SELECT MAX(id) FROM inodes') < 2 ** 31 db.close() # Compare self.mount() try: out = check_output(['rsync', '-anciHAX', '--delete', '--exclude', '/lost+found', ref_dir + '/', self.mnt_dir + '/'], universal_newlines=True, stderr=subprocess.STDOUT) except CalledProcessError as exc: pytest.fail('rsync failed with ' + exc.output) if out: pytest.fail('Copy not equal to original, rsync says:\n' + out) self.umount() finally: shutil.rmtree(ref_dir)
def runTest(self): populate_dir(self.ref_dir, entries=50, size=5*1024*1024) # Create and mount using previous S3QL version self.mkfs_old() self.mount_old() subprocess.check_call(['rsync', '-aHAX', self.ref_dir + '/', self.mnt_dir + '/']) self.umount_old() # Upgrade and compare without cache shutil.rmtree(self.cache_dir) self.cache_dir = tempfile.mkdtemp(prefix='s3ql-cache-') self.upgrade() self.compare()
def runTest(self): populate_dir(self.ref_dir, entries=50, size=5 * 1024 * 1024) # Create and mount using previous S3QL version self.mkfs_old() self.mount_old() subprocess.check_call( ['rsync', '-aHAX', self.ref_dir + '/', self.mnt_dir + '/']) self.umount_old() # Upgrade and compare without cache shutil.rmtree(self.cache_dir) self.cache_dir = tempfile.mkdtemp(prefix='s3ql-cache-') self.upgrade() self.compare()
def populate(self): populate_dir(self.ref_dir, entries=50, size=5*1024*1024)
def populate(self): populate_dir(self.ref_dir)
def populate_dir(self, path): populate_dir(path, entries=50, size=5*1024*1024)
def populate(self): populate_dir(self.ref_dir, entries=50, size=5 * 1024 * 1024)
def populate_dir(self, path): populate_dir(path)
def populate_dir(self, path): populate_dir(path, entries=50, size=5 * 1024 * 1024)