Lazily-connected MongoClient with wrong password raises AutoReconnect instead of OperationFailure

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 2.6
    • Affects Version/s: 2.5.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Initialize an unconnected MongoClient with the wrong password, then do an operation that triggers it to connect and authenticate:

      c = MongoClient(
          "mongodb://user:wrong@%s:%d/pymongo_test" % (host, port),
          _connect=False)
      
      c.pymongo_test.test.find_one()
      

      Expected: OperationFailure. Actual: AutoReconnect.

      MongoReplicaSetClient handles this case correctly.

      I revealed this bug in the process of fixing PYTHON-516. The fix is moderate-risk, low-reward, so I'm putting it off until PyMongo 2.6.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              A. Jesse Jiryu Davis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: