Skip to content

PYTHON-3464 Add FaaS platform to handshake metadata #1204

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

Merged
merged 7 commits into from
May 5, 2023

Conversation

@ShaneHarvey ShaneHarvey marked this pull request as ready for review May 4, 2023 20:37
@ShaneHarvey ShaneHarvey requested a review from blink1073 as a code owner May 4, 2023 20:37
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM!

@blink1073
Copy link
Member

The docs failure is unrelated and being worked on by RTD: readthedocs/readthedocs.org#10290 (comment)

@ShaneHarvey
Copy link
Member Author

ShaneHarvey commented May 4, 2023

Something funky is going on on windows:

 [2023/05/04 20:59:48.631] FAIL [0.004s]: test_metadata (test_client.ClientUnitTest)
 [2023/05/04 20:59:48.631] ----------------------------------------------------------------------
 [2023/05/04 20:59:48.631] Traceback (most recent call last):
 [2023/05/04 20:59:48.631]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 312, in test_metadata
 [2023/05/04 20:59:48.631]     self.assertEqual(options.pool_options.metadata, metadata)
 [2023/05/04 20:59:48.631] AssertionError: SON([[232 chars]cation', {'name': 'foobar'}), ('env', {'name': 'aws.lambda'})]) != SON([[232 chars]cation', {'name': 'foobar'})])
 [2023/05/04 20:59:48.631] ======================================================================
 [2023/05/04 20:59:48.631] FAIL [0.115s]: test_handshake_02_azure (test_client.TestExhaustCursor)
 [2023/05/04 20:59:48.631] ----------------------------------------------------------------------
 [2023/05/04 20:59:48.631] Traceback (most recent call last):
 [2023/05/04 20:59:48.631]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1893, in test_handshake_02_azure
 [2023/05/04 20:59:48.631]     self._test_handshake({"FUNCTIONS_WORKER_RUNTIME": "python"}, {"name": "azure.func"})
 [2023/05/04 20:59:48.631]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1880, in _test_handshake
 [2023/05/04 20:59:48.631]     self.assertEqual(options.pool_options.metadata, metadata)
 [2023/05/04 20:59:48.631] AssertionError: SON([[195 chars]', 'CPython 3.9.13.final.0')]) != SON([[195 chars]', 'CPython 3.9.13.final.0'), ('env', {'name': 'azure.func'})])
 [2023/05/04 20:59:48.631] ======================================================================
 [2023/05/04 20:59:48.631] FAIL [0.110s]: test_handshake_03_gcp (test_client.TestExhaustCursor)
 [2023/05/04 20:59:48.631] ----------------------------------------------------------------------
 [2023/05/04 20:59:48.631] Traceback (most recent call last):
 [2023/05/04 20:59:48.631]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1896, in test_handshake_03_gcp
 [2023/05/04 20:59:48.632]     self._test_handshake(
 [2023/05/04 20:59:48.632]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1880, in _test_handshake
 [2023/05/04 20:59:48.632]     self.assertEqual(options.pool_options.metadata, metadata)
 [2023/05/04 20:59:48.632] AssertionError: SON([[218 chars]l.0')]) != SON([[218 chars]l.0'), ('env', {'name': 'gcp.func', 'region': [50 chars]0})])
 [2023/05/04 20:59:48.632] ======================================================================
 [2023/05/04 20:59:48.632] FAIL [0.104s]: test_handshake_04_vercel (test_client.TestExhaustCursor)
 [2023/05/04 20:59:48.632] ----------------------------------------------------------------------
 [2023/05/04 20:59:48.632] Traceback (most recent call last):
 [2023/05/04 20:59:48.632]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1907, in test_handshake_04_vercel
 [2023/05/04 20:59:48.632]     self._test_handshake(
 [2023/05/04 20:59:48.632]   File "C:\data\mci\8a18dfd850b927c5f947ec33058782e2\src\test\test_client.py", line 1880, in _test_handshake
 [2023/05/04 20:59:48.632]     self.assertEqual(options.pool_options.metadata, metadata)
 [2023/05/04 20:59:48.632] AssertionError: SON([[209 chars]9.13.final.0')]) != SON([[209 chars]9.13.final.0'), ('env', {'name': 'vercel', 'region': 'cdg1'})])

https://spruce.mongodb.com/task/mongo_python_driver_tests_windows_python_version__platform~windows_64_vsMulti_small_auth_ssl~auth_ssl_python_version_windows~3.9_test_rapid_replica_set_patch_d340710e3d488f3906d0e3fa4d4f25e56779fc3a_645416552fbabe7cdbad46d7_23_05_04_20_32_22/logs?execution=0&sortBy=STATUS&sortDir=ASC

Edit: this was caused by https://jira.mongodb.org/browse/DRIVERS-2623

return True
env = os.getenv("AWS_EXECUTION_ENV")
if env:
return env.startswith("AWS_Lambda_")
Copy link
Member Author

Choose a reason for hiding this comment

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

This change was needed to fix the issue described in https://jira.mongodb.org/browse/DRIVERS-2623

@ShaneHarvey ShaneHarvey closed this May 5, 2023
@ShaneHarvey ShaneHarvey reopened this May 5, 2023
@ShaneHarvey ShaneHarvey merged commit 3d3e4dc into mongodb:master May 5, 2023
@ShaneHarvey ShaneHarvey deleted the PYTHON-3464 branch May 8, 2023 18:32
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