File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
max_staleness/ReplicaSetNoPrimary Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "in_latency_window" : [],
3
+ "read_preference" : {
4
+ "maxStalenessSeconds" : 1 ,
5
+ "mode" : " Nearest"
6
+ },
7
+ "suitable_servers" : [],
8
+ "topology_description" : {
9
+ "servers" : [
10
+ {
11
+ "address" : " a:27017" ,
12
+ "type" : " Unknown"
13
+ },
14
+ {
15
+ "address" : " b:27017" ,
16
+ "type" : " Unknown"
17
+ }
18
+ ],
19
+ "type" : " ReplicaSetNoPrimary"
20
+ }
21
+ }
Original file line number Diff line number Diff line change @@ -249,6 +249,10 @@ def test_max_staleness(self):
249
249
"maxStalenessSeconds=1" )
250
250
self .assertEqual (1 , client .read_preference .max_staleness )
251
251
252
+ client = MongoClient ("mongodb://a/?readPreference=secondary&"
253
+ "maxStalenessSeconds=1.5" )
254
+ self .assertAlmostEqual (1.5 , client .read_preference .max_staleness )
255
+
252
256
client = MongoClient ("mongodb://a/?readPreference=secondary&"
253
257
"maxStalenessSeconds=-1" )
254
258
self .assertEqual (- 1 , client .read_preference .max_staleness )
You can’t perform that action at this time.
0 commit comments