Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Adapt to CURL without NTLM support #320

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

ppisar
Copy link
Contributor

@ppisar ppisar commented Jul 11, 2024

If CURL is built without NTLM support (e.g. if libcurl-minimal RPM package is installed instead of libcurl on Fedora), tests/test_handle.c failed:

/home/test/librepo/tests/test_handle.c:61:F:Main:test_handle:0: Assertion 'lr_handle_setopt(h, ((void *)0), LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM)' failed

The cause is that the test exhibing NTLM authentication also checks that lr_handle_setopt() succeeds.

This patch stops checking a return value of lr_handle_setopt() in case of LR_AUTH_NTLM because a meaning of the test is checking for memory leaks.

If CURL is built without NTLM support (e.g. if libcurl-minimal RPM
package is installed instead of libcurl on Fedora),
tests/test_handle.c failed:

    /home/test/librepo/tests/test_handle.c:61:F:Main:test_handle:0: Assertion 'lr_handle_setopt(h, ((void *)0), LRO_HTTPAUTHMETHODS, LR_AUTH_NTLM)' failed

The cause is that the test exhibing NTLM authentication also checks that
lr_handle_setopt() succeeds.

This patch stops checking a return value of lr_handle_setopt() in case
of LR_AUTH_NTLM because a meaning of the test is checking for memory
leaks.

A similar issue was in python/tests/test_handle.py:

    ERROR: test_handle_setget_attr (tests.test_handle.TestCaseHandle.test_handle_setget_attr)
    No exception should be raised.
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/test/librepo/tests/python/tests/test_handle.py", line 477, in test_handle_setget_attr
	h.httpauthmethods = librepo.LR_AUTH_NTLM
	^^^^^^^^^^^^^^^^^
      File "/home/test/librepo/redhat-linux-build/librepo/python/librepo/__init__.py", line 1537, in __setattr__
	self.setopt(ATTR_TO_LRO[attr], val)
	~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/test/librepo/redhat-linux-build/librepo/python/librepo/__init__.py", line 1529, in setopt
	_librepo.Handle.setopt(self, option, val)
	~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
    librepo.LibrepoException: (8, 'curl error: A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.', 'An Curl handle error')

This patch ignores excpetions with that error message. (I did not find a way of
accessing fields of exception value directly.)
@ppisar
Copy link
Contributor Author

ppisar commented Jul 11, 2024

I also corrected a python test.

Copy link
Member

@m-blaha m-blaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@m-blaha m-blaha merged commit 74ec0b8 into rpm-software-management:master Jul 11, 2024
6 checks passed
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