-
Notifications
You must be signed in to change notification settings - Fork 91
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
MONGOCRYPT-749 Retry rewrapManyDataKey encrypt requests #922
base: master
Are you sure you want to change the base?
Conversation
afd7d11
to
eb50469
Compare
eb50469
to
293ced9
Compare
ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_NEED_KMS); // To encrypt. | ||
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); | ||
ASSERT(mongocrypt_kms_ctx_fail(kms)); // Simulate driver-side network failure for an encrypt request. | ||
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); // Assert fails. Expected KMS request to retry but did not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); // Assert fails. Expected KMS request to retry but did not. | |
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); // Expect KMS request to retry. |
_mongocrypt_ctx_rmd_datakey_t *it = rmdctx->datakeys; | ||
while (it != NULL) { | ||
_mongocrypt_ctx_datakey_t *dkctx = (_mongocrypt_ctx_datakey_t *)it->dkctx; | ||
if (dkctx->kms.should_retry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (dkctx->kms.should_retry) { | |
if (dkctx->kms.should_retry) { | |
dkctx->kms.should_retry = false; // Reset retry state. |
Similar to other contexts (example), reset should_retry
before returning.
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); | ||
ASSERT(mongocrypt_kms_ctx_fail(kms)); // Simulate driver-side network failure for an encrypt request. | ||
ASSERT((kms = mongocrypt_ctx_next_kms_ctx(ctx))); // Assert fails. Expected KMS request to retry but did not. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASSERT_OK(mongocrypt_kms_ctx_feed(kms, TEST_FILE("./test/data/rmd/kms-encrypt-reply-a.txt")), kms); | |
ASSERT(mongocrypt_kms_ctx_bytes_needed(kms) == 0); | |
ASSERT_OK(!mongocrypt_ctx_next_kms_ctx(ctx), ctx); | |
ASSERT_OK(mongocrypt_ctx_kms_done(ctx), ctx); | |
ASSERT_STATE_EQUAL(mongocrypt_ctx_state(ctx), MONGOCRYPT_CTX_READY); |
Suggest testing feeding the retried KMS context. This catches the missing should_retry = false
.
No description provided.