Skip to content

Commit e2f9bd1

Browse files
committed
PR feedback.
1 parent e014fc3 commit e2f9bd1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

x/mongo/driver/auth/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func init() {
4343
func CreateAuthenticator(name string, cred *Cred, httpClient *http.Client) (Authenticator, error) {
4444
// Return a custom error to indicate why auth mechanism "MONGODB-CR" is
4545
// missing, even though it was previously available.
46-
if strings.ToUpper(name) == "MONGODB-CR" {
47-
return nil, errors.New(`auth mechanism "MONGODB-CR" is not available in any supported version of MongoDB`)
46+
if strings.EqualFold(name, "MONGODB-CR") {
47+
return nil, errors.New(`auth mechanism "MONGODB-CR" is no longer available in any supported version of MongoDB`)
4848
}
4949

5050
if f, ok := authFactories[name]; ok {

x/mongo/driver/auth/auth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestCreateAuthenticator(t *testing.T) {
3535
{name: "", auth: &auth.DefaultAuthenticator{}},
3636
{name: "SCRAM-SHA-1", auth: &auth.ScramAuthenticator{}},
3737
{name: "SCRAM-SHA-256", auth: &auth.ScramAuthenticator{}},
38-
{name: "MONGODB-CR", err: errors.New(`auth mechanism "MONGODB-CR" is not available in any supported version of MongoDB`)},
38+
{name: "MONGODB-CR", err: errors.New(`auth mechanism "MONGODB-CR" is no longer available in any supported version of MongoDB`)},
3939
{name: "PLAIN", auth: &auth.PlainAuthenticator{}},
4040
{name: "MONGODB-X509", auth: &auth.MongoDBX509Authenticator{}},
4141
}
@@ -50,7 +50,7 @@ func TestCreateAuthenticator(t *testing.T) {
5050

5151
a, err := auth.CreateAuthenticator(test.name, cred, &http.Client{})
5252
if test.err != nil {
53-
require.Equal(t, test.err, err)
53+
require.EqualError(t, err, test.err.Error())
5454
return
5555
}
5656
require.NoError(t, err)

0 commit comments

Comments
 (0)