1
- # Copyright 2013-2015 MongoDB, Inc.
1
+ # Copyright 2013-present MongoDB, Inc.
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
4
# you may not use this file except in compliance with the License.
@@ -42,6 +42,7 @@ def test_client(self):
42
42
host = 'a:1,b:2,c:3' ,
43
43
replicaSet = 'rs' ,
44
44
serverSelectionTimeoutMS = 100 )
45
+ self .addCleanup (c .close )
45
46
46
47
# MongoClient connects to primary by default.
47
48
wait_until (lambda : c .address is not None , 'connect to primary' )
@@ -70,6 +71,7 @@ def test_replica_set_client(self):
70
71
mongoses = [],
71
72
host = 'a:1,b:2,c:3' ,
72
73
replicaSet = 'rs' )
74
+ self .addCleanup (c .close )
73
75
74
76
wait_until (lambda : ('b' , 2 ) in c .secondaries ,
75
77
'discover host "b"' )
@@ -97,6 +99,7 @@ def test_replica_set_client(self):
97
99
mongoses = [],
98
100
host = 'a:1,b:2,c:3' ,
99
101
replicaSet = 'rs' )
102
+ self .addCleanup (c .close )
100
103
101
104
wait_until (lambda : ('b' , 2 ) in c .secondaries , 'discover host "b"' )
102
105
wait_until (lambda : ('c' , 3 ) in c .secondaries , 'discover host "c"' )
@@ -119,6 +122,7 @@ def test_socket_error_marks_member_down(self):
119
122
mongoses = [],
120
123
host = 'a:1' ,
121
124
replicaSet = 'rs' )
125
+ self .addCleanup (c .close )
122
126
123
127
wait_until (lambda : len (c .nodes ) == 2 , 'discover both nodes' )
124
128
@@ -140,6 +144,7 @@ def test_client(self):
140
144
mongoses = [],
141
145
host = 'a:1' ,
142
146
replicaSet = 'rs' )
147
+ self .addCleanup (c .close )
143
148
144
149
wait_until (lambda : len (c .nodes ) == 2 , 'discover both nodes' )
145
150
@@ -166,6 +171,7 @@ def test_replica_set_client(self):
166
171
mongoses = [],
167
172
host = 'a:1' ,
168
173
replicaSet = 'rs' )
174
+ self .addCleanup (c .close )
169
175
170
176
wait_until (lambda : ('a' , 1 ) == c .primary , 'discover the primary' )
171
177
wait_until (lambda : set ([('b' , 2 )]) == c .secondaries ,
0 commit comments