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)
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)
def test_Basic(self): B.testConfiguration() testbackend.createNamespace("basebackup") target = testbackend.theBackend()("basebackup") backupWithMonitoring(self, self.source, target, endSnapshot="A") backupWithMonitoring(self, self.source, target, endSnapshot="C") backupWithMonitoring(self, self.source, target, endSnapshot="E") backupWithMonitoring(self, self.source, target)
def test_Monitoring(self): B.testConfiguration() ns = "monitortest" testbackend.createNamespace(ns) target = testbackend.theBackend()(ns) self.assertEqual(B.getProgressInfo(target), None) backupWithMonitoring(self, self.source, target) info = B.getProgressInfo(target) self.assertTrue(type(info), dict) self.assertEqual(info["total_size"], info["seen"]) self.assertEqual(info["still_to_be_examined"], 0) self.assertTrue(info["sent_to_backend"] <= info["total_size"])
def failrestore_test(self): # """ create a namespace # copy a volume to it # rename the volume # take a lock on the namespace # try to rename the volume again -> should fail # """ PITReplication.testConfiguration() ns = "failrestore-test" testbackend.createNamespace(ns) target = testbackend.theBackend()(ns) PITReplication.copy(self.source, target) PITReplication.renameVolume(target, "new_name1") pid = lockedexecutable.start(target) self.assertRaises(Exception, PITReplication.renameVolume, target, "new_name2", 'rename the volume again should fail') lockedexecutable.stop(pid)
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)