Skip to content

Fix unit tests with urllib3 2.8 - #670

Open
ricardobranco777 wants to merge 1 commit into
containers:mainfrom
ricardobranco777:fix-tests-urllib3-2.8
Open

ricardobranco777 wants to merge 1 commit into
containers:mainfrom
ricardobranco777:fix-tests-urllib3-2.8

Conversation

@ricardobranco777

Copy link
Copy Markdown
Contributor

urllib3 < 2.8 lowercased the whole host of the requested URL, so the percent-encoded unix socket path became %2frun%2fapi.sock, and the tests compared it against a lowercased expected URL.

Since urllib3 2.8.0 (urllib3/urllib3#5095, commit 6284887a "Reject invalid URL hosts") percent-encoded octets in the host are normalized to uppercase (RFC 3986), so those comparisons fail.

Lowercase the recorded request URL as well so the tests pass with both old and new urllib3.

Otherwise tests fail in openQA like this:

https://openqa-assets.opensuse.org/tests/6251400/file/python_podman-unit.txt

E       AssertionError: 'http://%2Frun%2Fapi.sock/v1.40/containers/json' != 'http://%2frun%2fapi.sock/v1.40/containers/json'
E       - http://%2Frun%2Fapi.sock/v1.40/containers/json
E       ?          ^     ^
E       + http://%2frun%2fapi.sock/v1.40/containers/json
E       ?          ^     ^

podman/tests/unit/test_containersmanager.py:258: AssertionError

urllib3 < 2.8 lowercased the whole host of the requested URL, so the
percent-encoded unix socket path became %2frun%2fapi.sock, and the
tests compared it against a lowercased expected URL.

Since urllib3 2.8.0 (urllib3/urllib3#5095,
commit 6284887a "Reject invalid URL hosts") percent-encoded octets in
the host are normalized to uppercase (RFC 3986), so those comparisons
fail.

Lowercase the recorded request URL as well so the tests pass with
both old and new urllib3.

Signed-off-by: Ricardo Branco <rbranco@suse.de>
@ricardobranco777

Copy link
Copy Markdown
Contributor Author

Verification run: https://openqa.opensuse.org/tests/6251415

@ricardobranco777

Copy link
Copy Markdown
Contributor Author

Looks like #667 fixed it first.

@Honny1

Honny1 commented Oct 6, 2026

Copy link
Copy Markdown
Member

@ricardobranco777 Thanks for the contribution! However, this is already fixed in #658. Could you please close this PR and review #658 instead? Thanks in advance!

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants