def failscrub_test(self):
        #        """ create a namespace
        #            prepare it with at least 2 snapshots for scrubbing (cfr. backup_test -> testScrubbingAndSnapshotMgmtTarget)
        #            scrub 1 snapshot -> should succeed
        #            take a lock on the namespace
        #            scrub the other snapshot -> should fail
        #        """
        PITReplication.testConfiguration()
        ns = "failscrub-test"
        testbackend.createNamespace(ns)
        target = testbackend.theBackend()(ns)

        def check(allss, toscrubss):
            self.assertEqual(PITReplication.getVolumeSnapshots(target), allss)
            self.assertEqual(
                PITReplication.getScrubSnapshots(target), toscrubss)

        for ss in PITReplication.getVolumeSnapshots(self.source):
            PITReplication.backup(self.source, target, endSnapshot=ss)

        check(['A', 'B', 'C', 'D', 'E', 'F'], [])

        PITReplication.deleteSnapshots(target, "B")
        check(['A', 'C', 'D', 'E', 'F'], ["C"])
        pid = lockedexecutable.start(target)
        # self.assertRaises(Exception,
        #                   PITReplication.scrubSnapshot,
        #                   target,
        #                   "C",
        #                   'scrub the other snapshot should fail')
        lockedexecutable.stop(pid)
Esempio n. 2
0
    def failscrub_test(self):
        #        """ create a namespace
        #            prepare it with at least 2 snapshots for scrubbing (cfr. backup_test -> testScrubbingAndSnapshotMgmtTarget)
        #            scrub 1 snapshot -> should succeed
        #            take a lock on the namespace
        #            scrub the other snapshot -> should fail
        #        """
        PITReplication.testConfiguration()
        ns = "failscrub-test"
        testbackend.createNamespace(ns)
        target = testbackend.theBackend()(ns)

        def check(allss, toscrubss):
            self.assertEqual(PITReplication.getVolumeSnapshots(target), allss)
            self.assertEqual(PITReplication.getScrubSnapshots(target),
                             toscrubss)

        for ss in PITReplication.getVolumeSnapshots(self.source):
            PITReplication.backup(self.source, target, endSnapshot=ss)

        check(['A', 'B', 'C', 'D', 'E', 'F'], [])

        PITReplication.deleteSnapshots(target, "B")
        check(['A', 'C', 'D', 'E', 'F'], ["C"])
        pid = lockedexecutable.start(target)
        # self.assertRaises(Exception,
        #                   PITReplication.scrubSnapshot,
        #                   target,
        #                   "C",
        #                   'scrub the other snapshot should fail')
        lockedexecutable.stop(pid)
Esempio n. 3
0
    def test_upgradeFrom3(self):
        source = Backend.LocalBackend(
            os.path.join(THISDIR, "data"))(VOLNAME + "-version3")
        self.makeDirs("target")
        target = Backend.LocalBackend(self.getDir())("target")

        self.assertEqual(B.getVolumeInfo(source)["volume_role"],
                         ToolCut.WanBackupVolumeRole.Normal)
        B.backup(source, target)
Esempio n. 4
0
    def test_upgradeFrom3(self):
        source = Backend.LocalBackend(os.path.join(
            THISDIR, "data"))(VOLNAME + "-version3")
        self.makeDirs("target")
        target = Backend.LocalBackend(self.getDir())("target")

        self.assertEqual(
            B.getVolumeInfo(source)["volume_role"],
            ToolCut.WanBackupVolumeRole.Normal)
        B.backup(source, target)
 def failbackup_test(self):
     #        """ create a namespace
     #            backup to certain snapshot -> should succeed
     #            take a lock on the namespace
     #            try to backup to the end of the volume -> this should fail
     #        """
     PITReplication.testConfiguration()
     ns = "failbackup-test"
     testbackend.createNamespace(ns)
     target = testbackend.theBackend()(ns)
     PITReplication.backup(self.source, target, startSnapshot="A")
     pid = lockedexecutable.start(target)
     self.assertRaises(Exception,
                       PITReplication.backup,
                       self.source,
                       target,
                       endSnapshot="C")
     lockedexecutable.stop(pid)
Esempio n. 6
0
 def failbackup_test(self):
     #        """ create a namespace
     #            backup to certain snapshot -> should succeed
     #            take a lock on the namespace
     #            try to backup to the end of the volume -> this should fail
     #        """
     PITReplication.testConfiguration()
     ns = "failbackup-test"
     testbackend.createNamespace(ns)
     target = testbackend.theBackend()(ns)
     PITReplication.backup(self.source, target, startSnapshot="A")
     pid = lockedexecutable.start(target)
     self.assertRaises(Exception,
                       PITReplication.backup,
                       self.source,
                       target,
                       endSnapshot="C")
     lockedexecutable.stop(pid)