def test_dry_run(manager: storage.StorageManager, to_delete: List[str]) -> None:
    delete_checkpoints(manager, to_delete, dry_run=True)
    assert len(os.listdir(manager._base_path)) == len(to_delete)
Example #2
0
def test_validate_failure(config: Dict[str, Any], to_delete: List[Dict[str, Any]]) -> None:
    host_path = config["checkpoint_storage"].pop("host_path")
    with pytest.raises(TypeError):
        delete_checkpoints(config, to_delete, validate=True, dry_run=False)

    assert len(os.listdir(host_path)) == len(to_delete)
Example #3
0
def test_delete_checkpoints(manager: storage.StorageManager,
                            to_delete: List[Dict[str, Any]]) -> None:
    delete_checkpoints(manager, to_delete, dry_run=False)
    assert len(os.listdir(manager._base_path)) == 0
Example #4
0
def test_validate_success(config: Dict[str, Any], to_delete: List[Dict[str, Any]]) -> None:
    delete_checkpoints(config, to_delete, validate=True, dry_run=False)

    host_path = config["checkpoint_storage"]["host_path"]
    assert len(os.listdir(host_path)) == 0