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

increase sleep time in cache test and flush test output #935

Merged
merged 12 commits into from
Jan 8, 2025

Conversation

kevinAlbs
Copy link
Contributor

Summary

  • Increase sleep time in _test_encrypt_cache_expiration.
  • Flush stdout and stderr in tests to fix test log output.

Verified by this patch build. The debian-package-build* task failures appear unrelated.

Background & Motivation

The sleep time in _test_encrypt_cache_expiration is increased from 2ms to 10ms to address observed test failures on Windows tasks. I expect this is due to the coarse resolution of bson_get_monotonic_time on Windows: CDRIVER-4526. bson_get_montonic_time is used to check the current time. Pending CDRIVER-4526, the test is updated to increase the sleep time to 20ms.

TEST_PRINTF and TEST_STDERR_PRINTF macros are added to flush stdout and stderr. This is intended to fix mixed log output from stdout and stderr. Before:

[2025/01/03 09:20:41.815] End test 'NIST CAVP No 'real' csfle library is available. The _test_encrypt_csfle_no_needs_markings test is a no-op.C:\data\mci\17866ad9f3891046e65d08db63c551ae\libmongocrypt\test\test-mongocrypt-ctx-encrypt.c:774 _test_encrypt_cache_expiration(): precondition failed: mongocrypt_ctx_state(ctx) == MONGOCRYPT_CTX_NEED_MONGO_KEYS

After:

[2025/01/07 16:29:44.388]   begin _test_encrypt_cache_expiration
[2025/01/07 16:29:44.388] C:\data\mci\01ac186cc57bfcd8230260d4e398ff47\libmongocrypt\test\test-mongocrypt-ctx-encrypt.c:774 _test_encrypt_cache_expiration(): precondition failed: mongocrypt_ctx_state(ctx) == MONGOCRYPT_CTX_NEED_MONGO_KEYS

Source files in kms-message are not currently formatted to the current .clang-format. This PR does not attempt to reformat. I used the .clang-format file from 8c9ed66 and ignored format-only diffs.

Account for possible coarse resolution of `bson_get_monotonic_time` on Windows
Flush stderr and stdout to avoid mixed output in logs.
To include newline.
Ignores formatting diffs. kms-message is not-yet formatted with current .clang-format.
@kevinAlbs kevinAlbs requested a review from eramongodb January 8, 2025 17:38
@kevinAlbs kevinAlbs changed the title increase sleep time in cache test increase sleep time in cache test and flush test output Jan 8, 2025
Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

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

Minor feedback; otherwise, LGTM.

kms-message/test/test_kms_request.c Outdated Show resolved Hide resolved
test/test-mongocrypt-ctx-encrypt.c Show resolved Hide resolved
@kevinAlbs kevinAlbs merged commit b193dba into mongodb:master Jan 8, 2025
45 of 47 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.

2 participants