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

Add RetryingClientEncryption and use it in one prose test #1365

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jyemin
Copy link
Contributor

@jyemin jyemin commented Apr 11, 2024

The intention is to reduce CI flakiness by retrying ClientEncryption operations that are known to fail occasionally in CI due to transient KMS errors.

The intention is to reduce CI flakiness by retrying ClientEncryption
operations that are known to fail occasionally in CI due to transient
KMS errors.
}

@Override
public ClientEncryption getClientEncryption(final ClientEncryptionSettings settings) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a bug in the test, as this should be creating a reactive ClientEncryption and wrapping it in a SyncClientEncryption.


public class ClientEncryptionRewrapManyDataKeyProseTest extends AbstractClientEncryptionRewrapManyDataKeyProseTest {

@Override
protected MongoClient createMongoClient(final MongoClientSettings settings) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never actually used, so removed it.

@AfterEach
void cleanUp(){
getMongoClient().getDatabase("keyvault").getCollection("datakeys").drop();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to drop on cleanup, since we drop on setup.

}

@Test
public void shouldThrowClientErrorWhenProviderIsNotSpecified() {
//given
ClientEncryption clientEncryption = getClientEncryption(ClientEncryptionSettings.builder()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now created in setup. But we don't want to wrap with RetryingClientEncryption because we are actually testing that the operation throws an exception.

BsonDocument srcKey = MASTER_KEYS_BY_PROVIDER.get(srcProvider);
BsonDocument dstKey = MASTER_KEYS_BY_PROVIDER.get(dstProvider);
BsonString testString = new BsonString("test");

getMongoClient().getDatabase("keyvault").getCollection("datakeys").drop();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to setup

testString,
new EncryptOptions("AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic").keyId(keyId));

ClientEncryption clientEncryption2 = getClientEncryption(ClientEncryptionSettings.builder()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These two ClientEncryption instances are identical. Is there any actual need to have two of them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant