How to use freezer - 10 common examples

To help you get started, we’ve selected a few freezer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / freezer / tests / unit / scheduler / test_scheduler_daemon.py View on Github external
def test_exit_handler(self, mock_logging):
        daemon.NoDaemon.exit_flag = False
        self.daemon.handle_program_exit(33, None)
        self.assertEquals(daemon.NoDaemon.exit_flag, True)
        self.assertTrue(self.daemonizable.stop.called)
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_restore_latest_backup(self):
        t = local.LocalStorage("", None, skip_prepare=True)
        t.find_all = mock.Mock()
        last = base.Backup(t, "host_backup", 5000)
        t.find_all.return_value = [
            base.Backup(t, "host_backup", 1000),
            base.Backup(t, "host_backup", 2000),
            base.Backup(t, "host_backup", 3000),
            base.Backup(t, "host_backup", 4000),
            base.Backup(t, "host_backup_f", 1000),
            last
        ]
        assert t.find_one("host_backup") == last
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_restore_from_date_increment(self):
        t = local.LocalStorage(None, None, skip_prepare=True)
        t.find_all = mock.Mock()
        test_backup = base.Backup(None, "host_backup", 1000)
        increment = base.Backup(None, "host_backup", 3200, 1, test_backup)
        test_backup.add_increment(increment)
        t.find_all.return_value = [
            test_backup,
            base.Backup(None, "host_backup", 4000),
            base.Backup(None, "host_backup_f", 1000),
            base.Backup(None, "host_backup", 5000),
        ]
        assert t.find_one("host_backup", 3234) == increment
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_backup_parse(self):
        self.assertRaises(ValueError, base.Backup._parse, "asdfasdfasdf")
        backup = base.Backup._parse("test_name_host_1234_0")
        self.assertEqual(backup.level, 0)
        self.assertEqual(backup.timestamp, 1234)
        self.assertEqual(backup.hostname_backup_name, "test_name_host")
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_add_increment_raises(self):
        backup = base.Backup(None, "name", 1234, level=3)
        self.assertRaises(ValueError, backup.add_increment, None)
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_find_latest_backup_respects_increments_timestamp(self):
        test_backup = base.Backup(None, "host_backup", 5500)
        increment = base.Backup(None, "host_backup", 6000, 1, test_backup)
        test_backup.add_increment(increment)
        t = local.LocalStorage(None, None, skip_prepare=True)
        t.find_all = mock.Mock()
        t.find_all.return_value = [
            test_backup,
            base.Backup(None, "host_backup", 2000),
            base.Backup(None, "host_backup", 3000),
            base.Backup(None, "host_backup", 4000),
            base.Backup(None, "host_backup_f", 1000),
            base.Backup(None, "host_backup", 5000),
        ]
        assert t.find_one("host_backup") == increment
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_restore_from_date(self):
        t = local.LocalStorage(None, None, skip_prepare=True)
        t.find_all = mock.Mock()
        backup_restore = base.Backup(None, "host_backup", 3000)
        t.find_all.return_value = [
            base.Backup(None, "host_backup", 1000),
            base.Backup(None, "host_backup", 2000),
            backup_restore,
            base.Backup(None, "host_backup", 4000),
            base.Backup(None, "host_backup_f", 1000),
            base.Backup(None, "host_backup", 5000),
        ]
        assert t.find_one("host_backup", 3234) == backup_restore
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_find_latest_backup_respects_increments_timestamp(self):
        test_backup = base.Backup(None, "host_backup", 5500)
        increment = base.Backup(None, "host_backup", 6000, 1, test_backup)
        test_backup.add_increment(increment)
        t = local.LocalStorage(None, None, skip_prepare=True)
        t.find_all = mock.Mock()
        t.find_all.return_value = [
            test_backup,
            base.Backup(None, "host_backup", 2000),
            base.Backup(None, "host_backup", 3000),
            base.Backup(None, "host_backup", 4000),
            base.Backup(None, "host_backup_f", 1000),
            base.Backup(None, "host_backup", 5000),
        ]
        assert t.find_one("host_backup") == increment
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_create_backup(self):
        t = local.LocalStorage(None, None, skip_prepare=True)
        t.find_all = mock.Mock()
        t.find_all.return_value = []
        t._find_previous_backup = mock.Mock()
        t._find_previous_backup.return_value = \
            base.Backup(None, "host_backup", 3000, tar_meta=True)
        t.create_backup("", True, 12, False, False)
github openstack / freezer / tests / unit / storages / test_base.py View on Github external
def test_restore_latest_backup(self):
        t = local.LocalStorage("", None, skip_prepare=True)
        t.find_all = mock.Mock()
        last = base.Backup(t, "host_backup", 5000)
        t.find_all.return_value = [
            base.Backup(t, "host_backup", 1000),
            base.Backup(t, "host_backup", 2000),
            base.Backup(t, "host_backup", 3000),
            base.Backup(t, "host_backup", 4000),
            base.Backup(t, "host_backup_f", 1000),
            last
        ]
        assert t.find_one("host_backup") == last