Skip to content

Update /scram/auth_tests to handle SCRAM-SHA-256 error messages #1210

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

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/libmongoc/tests/test-mongoc-scram.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,24 @@ typedef enum {
void
_check_error (const bson_error_t *error, test_error_t expected_error)
{
int32_t domain = 0;
int32_t code = 0;
uint32_t domain = 0;
uint32_t code = 0;
const char *message = "";

switch (expected_error) {
case MONGOC_TEST_AUTH_ERROR:
case MONGOC_TEST_AUTH_ERROR: {
domain = MONGOC_ERROR_CLIENT;
code = MONGOC_ERROR_CLIENT_AUTHENTICATE;
message = "Authentication failed";
ASSERT_CMPUINT32 (error->domain, ==, domain);
ASSERT_CMPUINT32 (error->code, ==, code);
const char *const a = "Authentication failed";
const char *const b = "Unable to use";
const bool found =
strstr (error->message, a) || strstr (error->message, b);
ASSERT_WITH_MSG (
found, "[%s] does not contain [%s] or [%s]", error->message, a, b);
break;
}
case MONGOC_TEST_USER_NOT_FOUND_ERROR:
domain = MONGOC_ERROR_CLIENT;
code = MONGOC_ERROR_CLIENT_AUTHENTICATE;
Expand Down