Skip to content

Commit c6445f0

Browse files
eramongodbkevinAlbs
authored andcommitted
CDRIVER-4407 Add assertions that addKeyAltName() added keyAltName without failure (#1041)
1 parent 52cd426 commit c6445f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/libmongoc/tests/test-mongoc-client-side-encryption.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4132,12 +4132,15 @@ _test_unique_index_on_keyaltnames_case_2 (
41324132
bson_destroy (&key_doc);
41334133
}
41344134

4135-
/* Step 3: Repeat Step 2 and assert the operation does not fail. */
4135+
/* Step 3: Repeat Step 2, assert the operation does not fail, and assert the
4136+
* returned key document contains the keyAltName "abc" added in Step 2. */
41364137
{
41374138
bson_t key_doc;
41384139
ASSERT_OR_PRINT (mongoc_client_encryption_add_key_alt_name (
41394140
client_encryption, &new_key, "abc", &key_doc, &error),
41404141
error);
4142+
ASSERT (
4143+
match_bson (&key_doc, tmp_bson ("{'keyAltNames': ['abc']}"), false));
41414144
bson_destroy (&key_doc);
41424145
}
41434146

@@ -4156,13 +4159,16 @@ _test_unique_index_on_keyaltnames_case_2 (
41564159
}
41574160

41584161
/* Step 5: Use client_encryption to add a keyAltName "def" to the existing
4159-
* key and assert the operation does not fail. */
4162+
* key, assert the operation does not fail, and assert the returned key
4163+
* document contains the keyAltName "def" added during Setup. */
41604164
{
41614165
bson_t key_doc;
41624166
ASSERT_OR_PRINT (
41634167
mongoc_client_encryption_add_key_alt_name (
41644168
client_encryption, existing_key, "def", &key_doc, &error),
41654169
error);
4170+
ASSERT (
4171+
match_bson (&key_doc, tmp_bson ("{'keyAltNames': ['def']}"), false));
41664172
bson_destroy (&key_doc);
41674173
}
41684174

0 commit comments

Comments
 (0)