Skip to content

DRIVERS-3181 fix timeouts in CSE custom endpoint test #1791

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 3 commits into from
Apr 29, 2025

Conversation

kevinAlbs
Copy link
Contributor

@kevinAlbs kevinAlbs commented Apr 28, 2025

Summary

Update Client-Side Encryption prose test 7. Custom Endpoint Test to fix recently seen timeout failures:

  • Update case 4 to use localhost instead of AWS.
  • Use .invalid instead of .local for test URIs intended to be invalid.

Tested in C driver: mongodb/mongo-c-driver#2001

Background & Motivation

Drivers have seen recent test failures due to timeout. Node indicates failure in Client-Side Encryption prose test: 7. Custom Endpoint Test case 4. Drivers are expected to connect to a KMS using the endpoint string from mongocrypt_kms_ctx_endpoint, so this test seemed meaningful to ensure drivers are handling a custom port. To avoid the timeout to AWS, the test is updated to use the "kmip" provider (expected succeed with localhost:5698) with localhost:12345.

Java logs before a timeout:

Connecting to KMS server at doesnotexist.local:5698

doesnotexist.local is replaced with doesnotexist.invalid. Quoting RFC 2606:

".invalid" is intended for use in online construction of domain names that are sure to be invalid and which it is obvious at a glance are invalid.

Tests were run in the C driver. Though tests were not previously failing, logs indicate the test was very slow. On a prior commit:

[...] "/client_side_encryption/custom_endpoint" [...] "elapsed": 143.074858

With this PR:

[...] "/client_side_encryption/custom_endpoint" [...] "elapsed": 3.092288

Related: drivers do not use a consistent timeout for KMS requests (see DRIVERS-1049). I expect this is why C did not fail, and other drivers did.


Please complete the following before merging:

  • [ ] Update changelog.
  • Test changes in at least one language driver.
  • [ ] Test these changes against all server versions and topologies (including standalone, replica set, sharded
    clusters, and serverless).
    (N/A. Only changing KMS endpoint).

Intended to fix observed timeout connecting to AWS with an incorrect port. Connecting to `localhost:12345` is intended to fail immediately.
Intended to fix observed timeouts. `.invalid` is expected to fail to resolve immediately.
Not necessary to change since the URIs are not expected to be used. An error is expected earlier when connecting to the oauth endpoint. But the URIs are updated for consistency.
@kevinAlbs kevinAlbs changed the title Fix timeouts in CSE custom endpoint test DRIVERS-3181 fix timeouts in CSE custom endpoint test Apr 28, 2025
@kevinAlbs kevinAlbs marked this pull request as ready for review April 28, 2025 19:32
@kevinAlbs kevinAlbs requested a review from a team as a code owner April 28, 2025 19:32
@kevinAlbs kevinAlbs requested review from katcharov, rozza and baileympearson and removed request for a team and katcharov April 28, 2025 19:32
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

Tested here: mongodb/mongo-java-driver#1694

@baileympearson
Copy link
Contributor

baileympearson commented Apr 29, 2025

Tests pass in Node as well: https://spruce.mongodb.com/version/6810dc1f0896a00007d55f46/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

(CI failures are unrelated)

@kevinAlbs kevinAlbs merged commit c196d3a into mongodb:master Apr 29, 2025
5 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.

3 participants