#7 Update URL for image download test
Merged by jcline. Opened by adamwill.
adamwill/cloud-image-uploader update-download-test-url  into  main

Does this test currently pass for you?

It fails with

EOFError: Already at end of stream

for me. It seems requests is yielding a chunk containing b''. Adding

diff --git a/fedora_cloud_image_uploader/handler.py b/fedora_cloud_image_uploader/handler.py
index 3de0959..864f71c 100644
--- a/fedora_cloud_image_uploader/handler.py
+++ b/fedora_cloud_image_uploader/handler.py
@@ -151,7 +151,7 @@ class Uploader:
                 with open(image_dest, "wb") as fd:
                     for chunk in req.iter_content(chunk_size=16 * 1024):
                         checksum.update(chunk)
-                        if decompressor:
+                        if decompressor and chunk:
                             chunk = decompressor.decompress(chunk)
                         fd.write(chunk)
         except RequestException as e:

makes it pass and I think should be fine to add, but I'm curious if it's working for you and why that's the case.

huh. it passes fine for me, yeah:

[adamw@xps13a cloud-image-uploader (update-download-test-url %)]$ pytest -v
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.12.3, pytest-7.4.3, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/adamw/local/cloud-image-uploader
plugins: anyio-3.7.1, cov-4.0.0, vcr-1.0.2
collected 13 items                                                                                                                                                                           
tests/test_handler.py::test_gallery_name[compose0] PASSED                                                                                                                              [  7%]
tests/test_handler.py::test_gallery_name[compose1] PASSED                                                                                                                              [ 15%]
tests/test_handler.py::test_gallery_name[compose2] PASSED                                                                                                                              [ 23%]
tests/test_handler.py::test_gallery_name[compose3] PASSED                                                                                                                              [ 30%]
tests/test_handler.py::test_gallery_name[compose4] PASSED                                                                                                                              [ 38%]
tests/test_handler.py::test_old_unsupported_azure_compose PASSED                                                                                                                       [ 46%]
tests/test_handler.py::test_bodhi_fail PASSED                                                                                                                                          [ 53%]
tests/test_handler.py::test_release_info PASSED                                                                                                                                        [ 61%]
tests/test_handler.py::test_ansible_fail PASSED                                                                                                                                        [ 69%]
tests/test_handler.py::test_azure_filters PASSED                                                                                                                                       [ 76%]
tests/test_handler.py::test_non_handled_messages PASSED                                                                                                                                [ 84%]
tests/test_handler.py::test_consumer_handle_exceptions PASSED                                                                                                                          [ 92%]
tests/test_handler.py::test_download_image PASSED

I'm using Rawhide, with python 3.12.3. Of course, this kind of comparison is why it's good to have a tox or nox config and CI, was going to propose those later...

oh, and python3-requests-2.31.0-4.fc41.noarch

Odd. I'm working from a venv, but otherwise have the same versions.

I would be happy to have CI, I just have no idea how set it up on pagure.

Pull-Request has been merged by jcline

You can take a look at how it's done in fedora-kiwi-descriptions for an example on how to do it.

I documented it at https://www.happyassassin.net/posts/2020/02/12/using-zuul-ci-with-pagure-io/ . It's a bit of a pain.