@@ -125,4 +125,34 @@ func TestSDAMProse(t *testing.T) {
125
125
assert .Soon (t , callback , defaultCallbackTimeout )
126
126
})
127
127
})
128
+
129
+ mt .RunOpts ("client waits between failed Hellos" , mtest .NewOptions ().MinServerVersion ("4.9" ).Topologies (mtest .Single ), func (mt * mtest.T ) {
130
+ // Force hello requests to fail 5 times.
131
+ mt .SetFailPoint (mtest.FailPoint {
132
+ ConfigureFailPoint : "failCommand" ,
133
+ Mode : mtest.FailPointMode {
134
+ Times : 5 ,
135
+ },
136
+ Data : mtest.FailPointData {
137
+ FailCommands : []string {internal .LegacyHello , "hello" },
138
+ ErrorCode : 1234 ,
139
+ AppName : "SDAMMinHeartbeatFrequencyTest" ,
140
+ },
141
+ })
142
+
143
+ // Reset client options to use direct connection, app name, and 5s SS timeout.
144
+ clientOpts := options .Client ().SetDirect (true ).
145
+ SetAppName ("SDAMMinHeartbeatFrequencyTest" ).
146
+ SetServerSelectionTimeout (5 * time .Second )
147
+ mt .ResetClient (clientOpts )
148
+
149
+ // Assert that Ping completes successfully within 2 to 3.5 seconds.
150
+ start := time .Now ()
151
+ err := mt .Client .Ping (mtest .Background , nil )
152
+ assert .Nil (mt , err , "Ping error: %v" , err )
153
+ pingTime := time .Since (start )
154
+ assert .True (mt , pingTime > 2000 * time .Millisecond && pingTime < 3500 * time .Millisecond ,
155
+ "expected Ping to take between 2 and 3.5 seconds, took %v seconds" , pingTime .Seconds ())
156
+
157
+ })
128
158
}
0 commit comments