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)