Skip to content

Conversation

@ShaneHarvey
Copy link
Member

Add support for validating parsed_options and running non-TLS tests.

This implements the following (ancient) spec changes which never has drivers tickets created for them:

Add support for validating parsed_options and running non-TLS tests.
test/test_dns.py Outdated
opts['readPreferenceTags'] = rpts
self.assertEqual(result['options'], options)
if parsed_options:
for opt in parsed_options:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: might it be better style to get the key AND value at once from parsed_options?

for opt, expected in parsed_options.items(): 
    ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

if hostname == 'localhost':
copts = client_context.default_client_options.copy()
# Remove tls since SRV parsing should add it automatically.
copts.pop('tls', None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this pose another problem? Since kwargs override opts passed in the URI, we might be overriding what the test wants to pass? Should we check the keys in result to ensure that none of them matches keys in copts?

Copy link
Member Author

Choose a reason for hiding this comment

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

The only test that does this is the ssl=false test which is handled by the needs_tls logic above. So I don't think there's any issue here.

@ShaneHarvey ShaneHarvey requested a review from prashantmital May 4, 2021 00:20
@ShaneHarvey ShaneHarvey merged commit 0535f5d into mongodb:master May 4, 2021
ShaneHarvey added a commit that referenced this pull request May 4, 2021
Add support for validating parsed_options and running non-TLS tests.

(cherry picked from commit 0535f5d)
@ShaneHarvey ShaneHarvey deleted the PYTHON-2678 branch May 4, 2021 21:30
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