Skip to content

Commit b3ca622

Browse files
DmitryLukyanovBorisDog
authored andcommitted
CSHARP-4455: Fix test assertation. (mongodb#994)
1 parent 454f37c commit b3ca622

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/MongoDB.Driver.Tests/Specifications/client-side-encryption/prose-tests/ClientEncryptionProseTests.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,17 @@ void AssertException(Exception ex)
17371737
// AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must not be configured
17381738
case "aws":
17391739
{
1740-
AssertInnerEncryptionException<AmazonServiceException>(ex, "Unable to get IAM security credentials from EC2 Instance Metadata Service.");
1740+
try
1741+
{
1742+
AssertInnerEncryptionException<AmazonServiceException>(ex, "Unable to get IAM security credentials from EC2 Instance Metadata Service.");
1743+
}
1744+
catch (XunitException)
1745+
{
1746+
// In rare cases, the thrown error is "CryptException exception: AcceessDeniedException". That means you don't have authorization to perform the requested action.
1747+
// It more or less corresponds to the expected behavior here, but it's unclear why the same scenario triggers different exceptions.
1748+
// However, it looks harmless to slightly update the test assertion to avoid assertion failures on EG.
1749+
AssertInnerEncryptionException<CryptException>(ex, "Error in KMS response. HTTP status=400. Response body=\n{\"__type\":\"AccessDeniedException\"}");
1750+
}
17411751
}
17421752
break;
17431753
case "azure":

0 commit comments

Comments
 (0)