Skip to content

Commit

Permalink
Resolve gssapi failures
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvasquez committed Nov 27, 2023
1 parent cebee19 commit 934323d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x/mongo/driver/auth/gssapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type GSSAPIAuthenticator struct {

// Auth authenticates the connection.
func (a *GSSAPIAuthenticator) Auth(ctx context.Context, cfg *Config) error {
target := cfg.Description.Addr.String()
target := cfg.Connection.Description().Addr.String()
hostname, _, err := net.SplitHostPort(target)
if err != nil {
return newAuthError(fmt.Sprintf("invalid endpoint (%s) specified: %s", target, err), nil)
Expand Down
6 changes: 5 additions & 1 deletion x/mongo/driver/auth/gssapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"go.mongodb.org/mongo-driver/mongo/address"
"go.mongodb.org/mongo-driver/mongo/description"
"go.mongodb.org/mongo-driver/x/mongo/driver/drivertest"
)

func TestGSSAPIAuthenticator(t *testing.T) {
Expand All @@ -36,7 +37,10 @@ func TestGSSAPIAuthenticator(t *testing.T) {
},
Addr: address.Address("foo:27017"),
}
err := authenticator.Auth(context.Background(), &Config{Description: desc})
chanconn := &drivertest.ChannelConn{
Desc: desc,
}
err := authenticator.Auth(context.Background(), &Config{Connection: chanconn})
if err == nil {
t.Fatalf("expected err, got nil")
}
Expand Down

0 comments on commit 934323d

Please sign in to comment.