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

CaCertsTest.test_request_with_verifypeer fails #822

Open
mcepl opened this issue Oct 12, 2023 · 4 comments
Open

CaCertsTest.test_request_with_verifypeer fails #822

mcepl opened this issue Oct 12, 2023 · 4 comments

Comments

@mcepl
Copy link

mcepl commented Oct 12, 2023

What did you try to do?

While building the official packages for openSUSE/Tumbleweed, I run the test suite. The test CaCertsTest.test_request_with_verifypeer failed with this error:

[   28s] =================================== FAILURES ===================================
[   28s] ___________________ CaCertsTest.test_request_with_verifypeer ___________________
[   28s] 
[   28s] self = <tests.cadata_test.CaCertsTest testMethod=test_request_with_verifypeer>
[   28s] 
[   28s]     @util.only_ssl_backends('openssl')
[   28s]     def test_request_with_verifypeer(self):
[   28s]         with open(os.path.join(os.path.dirname(__file__), 'certs', 'ca.crt'), 'rb') as stream:
[   28s]             cadata = stream.read().decode('ASCII')
[   28s]         self.curl.setopt(pycurl.URL, 'https://localhost:8384/success')
[   28s]         sio = util.BytesIO()
[   28s]         self.curl.set_ca_certs(cadata)
[   28s]         self.curl.setopt(pycurl.WRITEFUNCTION, sio.write)
[   28s]         # self signed certificate, but ca cert should be loaded
[   28s]         self.curl.setopt(pycurl.SSL_VERIFYPEER, 1)
[   28s] >       self.curl.perform()
[   28s] E       pycurl.error: (60, 'SSL certificate problem: self-signed certificate')
[   28s] 
[   28s] tests/cadata_test.py:31: error
[   28s] =============================== warnings summary ===============================
[   28s] tests/cadata_test.py::CaCertsTest::test_request_with_verifypeer
[   28s]   /usr/lib/python3.9/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-1
[   28s]   
[   28s]   Traceback (most recent call last):
[   28s]     File "/usr/lib64/python3.9/threading.py", line 980, in _bootstrap_inner
[   28s]       self.run()
[   28s]     File "/home/abuild/rpmbuild/BUILD/pycurl-7.45.2/tests/runwsgi.py", line 69, in run
[   28s]       bottle.run(self.app, server=self.server, quiet=True)
[   28s]     File "/usr/bin/bottle.py", line 3175, in run
[   28s]       server.run(app)
[   28s]     File "/home/abuild/rpmbuild/BUILD/pycurl-7.45.2/tests/runwsgi.py", line 34, in run
[   28s]       self.srv = self.make_server(handler)
[   28s]     File "/home/abuild/rpmbuild/BUILD/pycurl-7.45.2/tests/runwsgi.py", line 24, in make_server
[   28s]       srv = make_server(self.host, self.port, handler, **self.options)
[   28s]     File "/usr/lib64/python3.9/wsgiref/simple_server.py", line 154, in make_server
[   28s]       server = server_class((host, port), handler_class)
[   28s]     File "/usr/lib64/python3.9/socketserver.py", line 452, in __init__
[   28s]       self.server_bind()
[   28s]     File "/usr/lib64/python3.9/wsgiref/simple_server.py", line 50, in server_bind
[   28s]       HTTPServer.server_bind(self)
[   28s]     File "/usr/lib64/python3.9/http/server.py", line 137, in server_bind
[   28s]       socketserver.TCPServer.server_bind(self)
[   28s]     File "/usr/lib64/python3.9/socketserver.py", line 466, in server_bind
[   28s]       self.socket.bind(self.server_address)
[   28s]   OSError: [Errno 98] Address already in use
[   28s]   
[   28s]     warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
[   28s] 
[   28s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[   28s] ===Flaky Test Report===
[   28s] 
[   28s] test_pause_via_call passed 1 out of the required 1 times. Success!
[   28s] test_pause_via_return passed 1 out of the required 1 times. Success!
[   28s] test_post_byte_buffer passed 1 out of the required 1 times. Success!
[   28s] test_post_fields_with_ampersand passed 1 out of the required 1 times. Success!
[   28s] test_post_file passed 1 out of the required 1 times. Success!
[   28s] test_post_list_of_list_of_lists passed 1 out of the required 1 times. Success!
[   28s] test_post_list_of_tuple_of_tuples passed 1 out of the required 1 times. Success!
[   28s] test_post_multiple_fields passed 1 out of the required 1 times. Success!
[   28s] test_post_single_field passed 1 out of the required 1 times. Success!
[   28s] test_post_tuple_of_lists_of_tuples passed 1 out of the required 1 times. Success!
[   28s] test_post_tuple_of_tuple_of_lists passed 1 out of the required 1 times. Success!
[   28s] test_post_tuple_of_tuples_of_tuples passed 1 out of the required 1 times. Success!
[   28s] test_post_unicode_buffer passed 1 out of the required 1 times. Success!
[   28s] test_post_with_null_byte passed 1 out of the required 1 times. Success!
[   28s] 
[   28s] ===End Flaky Test Report===
[   28s] =========================== short test summary info ============================
[   28s] FAILED tests/cadata_test.py::CaCertsTest::test_request_with_verifypeer - pycu...
[   28s] ===== 1 failed, 374 passed, 7 skipped, 44 deselected, 1 warning in 13.57s ======

What happened?

The test failed.

See also complete build log with all packages used and steps taken to reproduce.

What is the PycURL version?

7.45.2

What is your Python version?

various (3.9.18, 3.10.13, 3.11.5)

What is your operating system and its version?

openSUSE/Tumbleweed (as of today, see the above log for the complete list of versions of packages used).

@swt2c
Copy link
Contributor

swt2c commented Oct 12, 2023

Does that test fail consistently, or intermittently? It seems like the problem might actually be that a previous test's server might have been still running, causing that OSError: [Errno 98] Address already in use where the port was still in use, perhaps.

@mcepl
Copy link
Author

mcepl commented Oct 12, 2023

That’s possible, but shouldn’t the test runner (or something) make sure that the previous server is gone before the new test is run?

@swt2c
Copy link
Contributor

swt2c commented Oct 12, 2023

It's supposed to. I'm just wondering if this problem is reliably reproducible or not.

@mcepl
Copy link
Author

mcepl commented Oct 12, 2023

For me it was 5 fails out of 5 attempts.

bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 12, 2023
https://build.opensuse.org/request/show/1117519
by user mcepl + anag+factory
- Skip test_multi_socket_select (gh#pycurl/pycurl#819),
  test_multi_socket_action (gh#pycurl/pycurl#729), and
  test_request_with_verifypeer (gh#pycurl/pycurl#822).
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Oct 14, 2023
https://build.opensuse.org/request/show/1117519
by user mcepl + anag+factory
- Skip test_multi_socket_select (gh#pycurl/pycurl#819),
  test_multi_socket_action (gh#pycurl/pycurl#729), and
  test_request_with_verifypeer (gh#pycurl/pycurl#822).
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

No branches or pull requests

2 participants