PYTHON-5415 - Unskip tests that rely on server hostname by NoahStapp · Pull Request #2398 · mongodb/mongo-python-driver · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

PYTHON-5415 - Unskip tests that rely on server hostname #2398

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NoahStapp
Copy link
Contributor

No description provided.

@NoahStapp NoahStapp requested a review from ShaneHarvey June 24, 2025 18:53
@ShaneHarvey
Copy link
Member

Is this test failure expected?

 [2025/06/24 12:09:51.722] E               _cffi_ssl._stdssl.error.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: ok
 [2025/06/24 12:09:51.722] /opt/python/pypy3.10/lib/pypy3.10/_cffi_ssl/_stdssl/__init__.py:717: SSLCertVerificationError
 [2025/06/24 12:09:51.722] The above exception was the direct cause of the following exception:
 [2025/06/24 12:09:51.722] self = <test.asynchronous.test_ssl.TestSSL testMethod=test_cert_ssl_validation_hostname_matching>
 [2025/06/24 12:09:51.722]     @async_client_context.require_tlsCertificateKeyFile
 [2025/06/24 12:09:51.722]     @async_client_context.require_server_resolvable
 [2025/06/24 12:09:51.722]     @ignore_deprecations
 [2025/06/24 12:09:51.722]     async def test_cert_ssl_validation_hostname_matching(self):
 [2025/06/24 12:09:51.722]         # Expects the server to be running with server.pem and ca.pem
 [2025/06/24 12:09:51.722]         #
 [2025/06/24 12:09:51.722]         #   --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
 [2025/06/24 12:09:51.722]         #   --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, True, True, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, True, False, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, False, True, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, False, False, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertTrue(ctx.check_hostname)
 [2025/06/24 12:09:51.722] >       response = await self.client.admin.command(HelloCompat.LEGACY_CMD)
 [2025/06/24 12:09:51.722] test/asynchronous/test_ssl.py:324:

https://spruce.mongodb.com/task/mongo_python_driver_mongodb_v5.0_test_server_version_pypy3.10_async_auth_ssl_sharded_cluster_patch_65f7c542088356bba78bd70d68b7a4881cab7f8b_685af42143a41e0007c096a5_25_06_24_18_53_22/tests?execution=0&sortBy=STATUS&sortDir=ASC

@NoahStapp
Copy link
Contributor Author

NoahStapp commented Jun 25, 2025

Is this test failure expected?

 [2025/06/24 12:09:51.722] E               _cffi_ssl._stdssl.error.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: ok
 [2025/06/24 12:09:51.722] /opt/python/pypy3.10/lib/pypy3.10/_cffi_ssl/_stdssl/__init__.py:717: SSLCertVerificationError
 [2025/06/24 12:09:51.722] The above exception was the direct cause of the following exception:
 [2025/06/24 12:09:51.722] self = <test.asynchronous.test_ssl.TestSSL testMethod=test_cert_ssl_validation_hostname_matching>
 [2025/06/24 12:09:51.722]     @async_client_context.require_tlsCertificateKeyFile
 [2025/06/24 12:09:51.722]     @async_client_context.require_server_resolvable
 [2025/06/24 12:09:51.722]     @ignore_deprecations
 [2025/06/24 12:09:51.722]     async def test_cert_ssl_validation_hostname_matching(self):
 [2025/06/24 12:09:51.722]         # Expects the server to be running with server.pem and ca.pem
 [2025/06/24 12:09:51.722]         #
 [2025/06/24 12:09:51.722]         #   --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
 [2025/06/24 12:09:51.722]         #   --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, True, True, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, True, False, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, False, True, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertFalse(ctx.check_hostname)
 [2025/06/24 12:09:51.722]         ctx = get_ssl_context(None, None, None, None, False, False, False, _IS_SYNC)
 [2025/06/24 12:09:51.722]         self.assertTrue(ctx.check_hostname)
 [2025/06/24 12:09:51.722] >       response = await self.client.admin.command(HelloCompat.LEGACY_CMD)
 [2025/06/24 12:09:51.722] test/asynchronous/test_ssl.py:324:

spruce.mongodb.com/task/mongo_python_driver_mongodb_v5.0_test_server_version_pypy3.10_async_auth_ssl_sharded_cluster_patch_65f7c542088356bba78bd70d68b7a4881cab7f8b_685af42143a41e0007c096a5_25_06_24_18_53_22/tests?execution=0&sortBy=STATUS&sortDir=ASC

No, but the test appears to be flakey on async + pypy, which is in line with the existing SSL issues we see there. Skipping the test on PyPy + async would reduce the noise until the pypy issue is resolved.

The non-PyPy failure is on the stable API variant because we don't pass serverApiVersion in these test commands. Skipping these server hostname tests on the stable API variant seems like the correct choice here, but I'm not entirely sure. What's the purpose of the stable API variant?

@ShaneHarvey
Copy link
Member

SGTM since we already use require_no_api_version on the other tests that use simple_client in that file.

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

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.