Skip to content

Commit 8ef42b5

Browse files
committed
WIP
1 parent 006d36b commit 8ef42b5

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

internal/integration/sessions_test.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"time"
1818

1919
"go.mongodb.org/mongo-driver/v2/bson"
20-
"go.mongodb.org/mongo-driver/v2/event"
2120
"go.mongodb.org/mongo-driver/v2/internal/assert"
2221
"go.mongodb.org/mongo-driver/v2/internal/integration/mtest"
2322
"go.mongodb.org/mongo-driver/v2/internal/mongoutil"
@@ -598,40 +597,7 @@ func TestSessionsProse(t *testing.T) {
598597
*/
599598

600599
mt.Run("ping test", func(mt *mtest.T) {
601-
serverMonitor := &event.ServerMonitor{
602-
ServerHeartbeatStarted: func(e *event.ServerHeartbeatStartedEvent) {
603-
fmt.Println("Server heartbeat started:", e.ConnectionID)
604-
},
605-
ServerHeartbeatSucceeded: func(e *event.ServerHeartbeatSucceededEvent) {
606-
fmt.Println("Server heartbeat succeeded:", e.ConnectionID, e.Duration, e.Reply)
607-
},
608-
}
609-
610-
commandMonitor := &event.CommandMonitor{
611-
Started: func(_ context.Context, cse *event.CommandStartedEvent) {
612-
fmt.Println("Command started:", cse.CommandName, cse.Command)
613-
},
614-
Succeeded: func(_ context.Context, cse *event.CommandSucceededEvent) {
615-
fmt.Println("Command succeeded:", cse.CommandName, cse.Reply)
616-
},
617-
}
618-
619-
opts := options.Client().
620-
ApplyURI(mtest.ClusterURI()).
621-
SetHosts([]string{mtest.ClusterConnString().Hosts[0]}).
622-
SetDirect(true).
623-
SetHeartbeatInterval(500 * time.Millisecond). // Minimum interval
624-
SetServerMonitor(serverMonitor).
625-
SetMonitor(commandMonitor)
626-
627-
client, err := mongo.Connect(opts)
628-
require.NoError(mt, err, "expected no error connecting to client, got: %v", err)
629-
defer func() {
630-
err = client.Disconnect(context.Background())
631-
require.NoError(mt, err, "expected no error disconnecting client, got: %v", err)
632-
}()
633-
634-
err = client.Ping(context.Background(), readpref.Primary())
600+
err := mt.Client.Ping(context.Background(), readpref.Primary())
635601
require.NoError(mt, err, "expected no error, got: %v", err)
636602
})
637603
}

0 commit comments

Comments
 (0)