@@ -508,6 +508,26 @@ func TestSessionsProse(t *testing.T) {
508508 assert .True (mt , limitedSessionUse , limitedSessMsg , len (ops ))
509509
510510 })
511+
512+ clustertimeopts := mtest .NewOptions ().ClientType (mtest .Pinned ).ClientOptions (options .Client ().SetDirect (true ).SetHeartbeatInterval (10 * time .Millisecond ))
513+ mt .RunOpts ("20 Drivers do not gossip $clusterTime on SDAM commands" , clustertimeopts , func (mt * mtest.T ) {
514+ res , err := mt .DB .RunCommand (context .Background (), bson.D {{"ping" , 1 }}).Raw ()
515+ require .NoError (mt , err , "expected no error, got: %v" , err )
516+ mt .Log ("result of ping command:" , res )
517+
518+ // assert $clusterTime was sent to server
519+ started := mt .GetStartedEvent ()
520+ require .NotNil (mt , started , "expected started event, got nil" )
521+ _ , err = started .Command .LookupErr ("$clusterTime" )
522+ require .NoError (mt , err , "$clusterTime not sent" )
523+
524+ // record response cluster time
525+ succeeded := mt .GetSucceededEvent ()
526+ require .NotNil (mt , succeeded , "expected succeeded event, got nil" )
527+ replyClusterTimeVal , err := succeeded .Reply .LookupErr ("$clusterTime" )
528+ require .NoError (mt , err , "$clusterTime not found in response" )
529+ mt .Fatalf ("$clusterTime: %v" , replyClusterTimeVal )
530+ })
511531}
512532
513533type sessionFunction struct {
0 commit comments