@with_uptane_backend(start_generic_server=True)
@with_director()
@with_treehub(handlers=[
    DownloadInterruptionHandler(
        url=
        '/objects/41/5ce9717fc7a5f4d743a4f911e11bd3ed83930e46756303fd13a3eb7ed35892.filez'
    ),
    MalformedImageHandler(
        url=
        '/objects/41/5ce9717fc7a5f4d743a4f911e11bd3ed83930e46756303fd13a3eb7ed35892.filez'
    ),
    RedirectHandler(
        number_of_redirects=1000,
        url=
        '/objects/41/5ce9717fc7a5f4d743a4f911e11bd3ed83930e46756303fd13a3eb7ed35892.filez'
    ),

    # TODO: OSTree object download is not resilient to `Slow Retrieval Attack`
    # https://saeljira.it.here.com/browse/OTA-3737
    #SlowRetrievalHandler(url='/objects/6b/1604b586fcbe052bbc0bd9e1c8040f62e085ca2e228f37df957ac939dff361.filez'),
])
@with_sysroot()
@with_aktualizr(start=False, run_mode='once')
def test_treehub_update_after_image_download_failure(uptane_repo, aktualizr,
                                                     director, uptane_server,
                                                     sysroot, treehub):
    target_rev = treehub.revision
    uptane_repo.add_ostree_target(aktualizr.id, target_rev)
    with aktualizr:
Пример #2
0
    return install_result and update_hash == aktualizr.get_current_image_info(
        aktualizr.id)


"""
    Verifies if aktualizr supports redirects - update is successful after redirect
    Note: should aktualizr support unlimited number of redirects
"""


@with_uptane_backend(start_generic_server=True)
# TODO: Limit a number of HTTP redirects within a single request processing
# https://saeljira.it.here.com/browse/OTA-3729
@with_customrepo(handlers=[
    RedirectHandler(number_of_redirects=10, url='/primary-image.img')
])
@with_imagerepo()
@with_director()
@with_aktualizr(run_mode='once', output_logs=True)
def test_customrepo_update_redirect(aktualizr, uptane_repo, custom_repo,
                                    director, **kwargs):
    update_hash = uptane_repo.add_image(aktualizr.id,
                                        'primary-image.img',
                                        custom_url=custom_repo.base_url + '/' +
                                        'primary-image.img')
    install_result = director.wait_for_install()
    return install_result and update_hash == aktualizr.get_current_image_info(
        aktualizr.id)