Skip to content

Commit 0bc75c1

Browse files
committed
Fix monitoring test under auth
1 parent 07d2199 commit 0bc75c1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/test_monitoring.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pymongo.command_cursor import CommandCursor
2222
from pymongo.errors import NotMasterError, OperationFailure
2323
from test import unittest, IntegrationTest, client_context
24+
from test.utils import single_client
2425

2526

2627
class EventListener(monitoring.Subscriber):
@@ -298,7 +299,10 @@ def test_get_more_failure(self):
298299
@client_context.require_replica_set
299300
def test_not_master_error(self):
300301
address = next(iter(self.client.secondaries))
301-
client = MongoClient(*address)
302+
client = single_client(*address)
303+
# Clear authentication command results from the listener.
304+
client.admin.command('ismaster')
305+
self.listener.results = {}
302306
error = None
303307
try:
304308
client.pymongo_test.test.find_one_and_delete({})

0 commit comments

Comments
 (0)