def testSendSnapshot(self): dataset = self.base_dataset + '/' + self.source_dataset snapshot = dataset + '@zfsbackup-sendtest' destination = self.base_dataset + '/' + self.dest_dataset zfsbackup.create_snapshot(dataset, 'zfsbackup-sendtest') zfsbackup.send_snapshot(snapshot, destination) snaps = zfsbackup.get_snapshots(destination) self.assertTrue(destination + '@zfsbackup-sendtest' in snaps)
def testCreateListDeleteSnapshot(self): dataset = self.base_dataset + '/' + self.source_dataset zfsbackup.create_snapshot(dataset, 'zfsbackup-unittest') desired_snap = self.base_dataset + '/' + self.source_dataset + '@zfsbackup-unittest' snaps = zfsbackup.get_snapshots(dataset) self.assertTrue(desired_snap in snaps) zfsbackup.delete_snapshot(desired_snap) snaps = zfsbackup.get_snapshots(dataset) self.assertTrue(desired_snap not in snaps)
def testSendSnapshotBadDest(self): dataset = self.base_dataset + '/' + self.source_dataset dest = self.base_dataset + '/non-existent-dataset/butreally' zfsbackup.create_snapshot(dataset, 'zfsbackup-sendtest') try: zfsbackup.send_snapshot(dataset + '@zfsbackup-sendtest', dest) except ZFSBackupError: return self.fail("Should have caught an exception")
def testSendSnapshotSSHAlt(self): dataset = self.base_dataset + '/' + self.source_dataset snapshot = dataset + '@zfsbackup-sendtest' destination = self.base_dataset + '/' + self.dest_dataset zfsbackup.create_snapshot(dataset, 'zfsbackup-sendtest') zfsbackup.send_snapshot(snapshot, destination, transport="ssh:root@localhost:44") snaps = zfsbackup.get_snapshots(destination) self.assertTrue(destination + '@zfsbackup-sendtest' in snaps)
def testSendSnapshotFail(self): dataset = self.base_dataset + '/' + self.source_dataset snapshot = dataset + '@zfsbackup-sendtest-fail' destination = self.base_dataset + '/' + self.other_dataset try: zfsbackup.create_snapshot(dataset, 'zfsbackup-sendtest-fail') zfsbackup.send_snapshot(snapshot, destination) except ZFSBackupError as e: snaps = zfsbackup.get_snapshots(destination) self.assertFalse(snapshot in snaps) return self.assertTrue(False)
def testCreateSnapshot(self): dataset = self.base_dataset + '/' + self.source_dataset snap = dataset + "@zfsbackup-unittest" zfsbackup.create_snapshot(dataset, 'zfsbackup-unittest') snaps = zfsbackup.get_snapshots(dataset) self.assertTrue(snap in snaps)