test_list_database_names should not check ordering

XMLWordPrintableJSON

    • Type: Build Failure
    • Resolution: Done
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Name of Failure:

      test_list_database_names

      Link to task:

      https://spruce.corp.mongodb.com/task/mongo_python_driver_compression_snappy_rhel8_test_standard_latest_python3.13_async_auth_ssl_sharded_cluster_cov_patch_08b806fd8764e1fe07aa2582452752f3bea2e632_69dd07006ee0270007cc9403_26_04_13_15_08_52/tests?execution=0&sorts=STATUS%3AASC

      Context of when and why the failure occurred:

      Latest server version changed the order of databases returned by test_list_database_names. Our test explicitly checks for order despite the spec not requiring it to do so.

      Stack trace:

      [2026/04/08 17:15:43.306] FAILURE: AssertionError: Lists differ: ['admin', 'config', 'db', 'database0', 'change-stream[76 chars]ike'] != ['admin', 'change-stream-tests', 'config', 'database0[76 chars]dDb']
      [2026/04/08 17:15:43.306] First differing element 1:
      [2026/04/08 17:15:43.306] 'config'
      [2026/04/08 17:15:43.306] 'change-stream-tests'
      [2026/04/08 17:15:43.306]   ['admin',
      [2026/04/08 17:15:43.306] +  'change-stream-tests',
      [2026/04/08 17:15:43.306]    'config',
      [2026/04/08 17:15:43.306] +  'database0',
      [2026/04/08 17:15:43.306]    'db',
      [2026/04/08 17:15:43.306] -  'database0',
      [2026/04/08 17:15:43.306] -  'change-stream-tests',
      [2026/04/08 17:15:43.306] -  'shardedDb',
      [2026/04/08 17:15:43.306]    'pymongo_test',
      [2026/04/08 17:15:43.306]    'pymongo_test_bernie',
      [2026/04/08 17:15:43.306] -  'pymongo_test_mike']
      [2026/04/08 17:15:43.306] ?                     ^
      [2026/04/08 17:15:43.306] +  'pymongo_test_mike',
      [2026/04/08 17:15:43.306] ?                     ^
      [2026/04/08 17:15:43.306] +  'shardedDb'] ()
      [2026/04/08 17:15:43.306] self = <test.asynchronous.test_client.TestClient testMethod=test_list_database_names>
      [2026/04/08 17:15:43.306]     async def test_list_database_names(self):
      [2026/04/08 17:15:43.306]         await self.client.pymongo_test.test.insert_one({"dummy": "object"})
      [2026/04/08 17:15:43.306]         await self.client.pymongo_test_mike.test.insert_one({"dummy": "object"})
      [2026/04/08 17:15:43.306]         cmd_docs = (await self.client.admin.command("listDatabases"))["databases"]
      [2026/04/08 17:15:43.306]         cmd_names = [doc["name"] for doc in cmd_docs]
      [2026/04/08 17:15:43.306]     
      [2026/04/08 17:15:43.306]         db_names = await self.client.list_database_names()
      [2026/04/08 17:15:43.306]         self.assertIn("pymongo_test", db_names)
      [2026/04/08 17:15:43.306]         self.assertIn("pymongo_test_mike", db_names)
      [2026/04/08 17:15:43.306] >       self.assertEqual(db_names, cmd_names)
      [2026/04/08 17:15:43.306] E       AssertionError: Lists differ: ['admin', 'config', 'db', 'database0', 'change-stream[76 chars]ike'] != ['admin', 'change-stream-tests', 'config', 'database0[76 chars]dDb']
      [2026/04/08 17:15:43.306] E       
      [2026/04/08 17:15:43.306] E       First differing element 1:
      [2026/04/08 17:15:43.306] E       'config'
      [2026/04/08 17:15:43.306] E       'change-stream-tests'
      [2026/04/08 17:15:43.306] E       
      [2026/04/08 17:15:43.306] E         ['admin',
      [2026/04/08 17:15:43.306] E       +  'change-stream-tests',
      [2026/04/08 17:15:43.306] E          'config',
      [2026/04/08 17:15:43.306] E       +  'database0',
      [2026/04/08 17:15:43.306] E          'db',
      [2026/04/08 17:15:43.306] E       -  'database0',
      [2026/04/08 17:15:43.306] E       -  'change-stream-tests',
      [2026/04/08 17:15:43.306] E       -  'shardedDb',
      [2026/04/08 17:15:43.306] E          'pymongo_test',
      [2026/04/08 17:15:43.306] E          'pymongo_test_bernie',
      [2026/04/08 17:15:43.306] E       -  'pymongo_test_mike']
      [2026/04/08 17:15:43.306] E       ?                     ^
      [2026/04/08 17:15:43.306] E       
      [2026/04/08 17:15:43.306] E       +  'pymongo_test_mike',
      [2026/04/08 17:15:43.306] E       ?                     ^
      [2026/04/08 17:15:43.306] E       
      [2026/04/08 17:15:43.306] E       +  'shardedDb']
      [2026/04/08 17:15:43.306] test/asynchronous/test_client.py:1037: AssertionError
      

            Assignee:
            Noah Stapp
            Reporter:
            Noah Stapp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: