示例#1
0
文件: t5_cp.py 项目: DirtYiCE/s3ql
    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)
示例#2
0
    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)
示例#3
0
文件: t5_cp.py 项目: powerpaul17/s3ql
    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)
示例#4
0
    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()
示例#5
0
    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()
示例#6
0
    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)
示例#7
0
    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)
示例#8
0
    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()
示例#9
0
    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()
示例#10
0
 def populate(self):
     populate_dir(self.ref_dir, entries=50, size=5*1024*1024)
示例#11
0
 def populate(self):
     populate_dir(self.ref_dir)
示例#12
0
文件: t5_full.py 项目: DirtYiCE/s3ql
 def populate_dir(self, path):
     populate_dir(path, entries=50, size=5*1024*1024)
示例#13
0
 def populate(self):
     populate_dir(self.ref_dir, entries=50, size=5 * 1024 * 1024)
示例#14
0
 def populate(self):
     populate_dir(self.ref_dir)
示例#15
0
 def populate_dir(self, path):
     populate_dir(path)
示例#16
0
 def populate_dir(self, path):
     populate_dir(path, entries=50, size=5 * 1024 * 1024)
示例#17
0
文件: t5_full.py 项目: DirtYiCE/s3ql
 def populate_dir(self, path):
     populate_dir(path)