pulp / pulp_container

Pulp Container Registry
https://docs.pulpproject.org/pulp_container/
GNU General Public License v2.0
23 stars 45 forks source link

Do not assert on a specific error message #1744

Closed lubosmj closed 3 months ago

lubosmj commented 3 months ago

Once an upstream library changes its behaviour, we may observe different error messages depending on the context.

This change fixes the following error:

assert "[Name or service not known]" in ctx.value.task.error["description"] E AssertionError: assert '[Name or service not known]' in 'Cannot connect to host i-am-an-invalid-url.com:80 ssl:default [None]'

[noissue]

lubosmj commented 3 months ago

https://github.com/pulp/pulp_container/actions/runs/10419563397/job/28857922300?pr=1738#step:15:4493

[gw2] [ 33%] FAILED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_sync_invalid_url 
[gw5] [ 44%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_tag_filtering_operations[include_tags0-expected_tags0] 
[gw6] [ 55%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_tag_filtering_operations[include_tags1-expected_tags1] 
[gw3] [ 66%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_sync_with_complex_filtering 
[gw7] [ 77%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_tag_filtering_operations[include_tags2-expected_tags2] 
[gw4] [ 88%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_sync_labelled_image 
[gw1] [100%] PASSED usr/local/lib/python3.9/site-packages/pulp_container/tests/functional/api/test_sync.py::test_basic_sync 

=================================== FAILURES ===================================
____________________________ test_sync_invalid_url _____________________________
[gw2] linux -- Python 3.9.19 /usr/bin/python3

synced_container_repository_factory = <function synced_container_repository_factory.<locals>._synced_container_repository_factory at 0x7febd412caf0>

    @pytest.mark.parallel
    def test_sync_invalid_url(synced_container_repository_factory):
        with pytest.raises(PulpTaskError) as ctx:
            synced_container_repository_factory(url="http://i-am-an-invalid-url.com/invalid/")

>       assert "[Name or service not known]" in ctx.value.task.error["description"]
E       AssertionError: assert '[Name or service not known]' in 'Cannot connect to host i-am-an-invalid-url.com:80 ssl:default [None]'

This error could be caused by using a new version of an upstream library by the bindings.

patchback[bot] commented 3 months ago

Backport to 2.21: 💚 backport PR created

✅ Backport PR branch: patchback/backports/2.21/d5d149ec8047132907a8c197692872caa8ccebc0/pr-1744

Backported as https://github.com/pulp/pulp_container/pull/1745

🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.