Ejemplo n.º 1
0
def test_when_export_image_then_export_hash(mocker, storage,
                                            given_stopped_container):
    container_name = given_stopped_container
    image = backup_container(container_name)

    storage.export(image)

    expected_file = '_'.join([utcnow().format('YYYY-MM-DD'), container_name])
    expected_hash_file = ''.join([expected_file, '.md5'])
    assert storage.exists(expected_file)
    assert storage.exists(expected_hash_file)
Ejemplo n.º 2
0
def test_when_obsolete_day_is_today_then_delete_it(mocker, storage):
    mocker.patch('lxd_backup.storage.today', return_value='1995-12-25')

    filename = '1992-10-26_until_1995-12-25_test-container'
    storage.create_file(filename)

    storage.cleanup()

    assert not storage.exists(filename)
Ejemplo n.º 3
0
def test_export_one_container_then_file_exists(given_stopped_container,
                                               storage):
    container_name = given_stopped_container
    image = backup_container(container_name)

    storage.export(image)

    expected_file = '_'.join([utcnow().format('YYYY-MM-DD'), container_name])
    assert storage.exists(expected_file)
Ejemplo n.º 4
0
def test_when_obsolete_backup_then_delete_it(mocker, storage):
    storage.create_file('1992-10-26_until_1998-01-15_test-container')

    storage.cleanup()

    assert not storage.exists('1992-10-26_until_1998-01-15_test-container')