ExportXMLWordPrintableJSON

    • 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.asynchronous.test_dns.TestDNSSharded.test_srvMaxHosts-equal_to_srv_records

      Link to task:

      https://spruce.corp.mongodb.com/task/mongo_python_driver_test_macos_arm64_test_standard_v9.0_python3.14_async_auth_ssl_sharded_cluster_3a8088d1b528fec6ac228c4ff4a774ddd6fd62bc_26_10_29_17_31_15/tests?execution=0&sorts=STATUS%3AASC

      Context of when and why the failure occurred:

      A heartbeat to one mongos fails and waits the full 10 seconds to retry, which causes the wait for all nodes to be discovered to timeout and fail the test.

      Stack trace:

      
      
      [2026/10/29 11:07:02.607] FAILURE: AssertionError: Didn't ever match test hosts to client nodes ()
      [2026/10/29 11:07:02.607] self = <test.asynchronous.test_dns.TestDNSSharded testMethod=test_srvMaxHosts-equal_to_srv_records>
      [2026/10/29 11:07:02.607]     async def run_test(self):
      [2026/10/29 11:07:02.607]         uri = test_case["uri"]
      [2026/10/29 11:07:02.607]         seeds = test_case.get("seeds")
      [2026/10/29 11:07:02.607]         num_seeds = test_case.get("numSeeds", len(seeds or []))
      [2026/10/29 11:07:02.607]         hosts = test_case.get("hosts")
      [2026/10/29 11:07:02.607]         num_hosts = test_case.get("numHosts", len(hosts or []))
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         options = test_case.get("options", {})
      [2026/10/29 11:07:02.607]         if "ssl" in options:
      [2026/10/29 11:07:02.607]             options["tls"] = options.pop("ssl")
      [2026/10/29 11:07:02.607]         parsed_options = test_case.get("parsed_options")
      [2026/10/29 11:07:02.607]         # See DRIVERS-1324, unless tls is explicitly set to False we need TLS.
      [2026/10/29 11:07:02.607]         needs_tls = not (options and (options.get("ssl") is False or options.get("tls") is False))
      [2026/10/29 11:07:02.607]         if needs_tls and not async_client_context.tls:
      [2026/10/29 11:07:02.607]             self.skipTest("this test requires a TLS cluster")
      [2026/10/29 11:07:02.607]         if not needs_tls and async_client_context.tls:
      [2026/10/29 11:07:02.607]             self.skipTest("this test requires a non-TLS cluster")
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         if seeds:
      [2026/10/29 11:07:02.607]             seeds = split_hosts(",".join(seeds))
      [2026/10/29 11:07:02.607]         if hosts:
      [2026/10/29 11:07:02.607]             hosts = frozenset(split_hosts(",".join(hosts)))
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         if seeds or num_seeds:
      [2026/10/29 11:07:02.607]             result = await parse_uri(uri, validate=True)
      [2026/10/29 11:07:02.607]             if seeds is not None:
      [2026/10/29 11:07:02.607]                 self.assertEqual(sorted(result["nodelist"]), sorted(seeds))
      [2026/10/29 11:07:02.607]             if num_seeds is not None:
      [2026/10/29 11:07:02.607]                 self.assertEqual(len(result["nodelist"]), num_seeds)
      [2026/10/29 11:07:02.607]             if options:
      [2026/10/29 11:07:02.607]                 opts = result["options"]
      [2026/10/29 11:07:02.607]                 if "readpreferencetags" in opts:
      [2026/10/29 11:07:02.607]                     rpts = validate_read_preference_tags(
      [2026/10/29 11:07:02.607]                         "readPreferenceTags", opts.pop("readpreferencetags")
      [2026/10/29 11:07:02.607]                     )
      [2026/10/29 11:07:02.607]                     opts["readPreferenceTags"] = rpts
      [2026/10/29 11:07:02.607]                 for opt in options:
      [2026/10/29 11:07:02.607]                     self.assertIn(opt, result["options"])
      [2026/10/29 11:07:02.607]             if parsed_options:
      [2026/10/29 11:07:02.607]                 for opt, expected in parsed_options.items():
      [2026/10/29 11:07:02.607]                     if opt == "user":
      [2026/10/29 11:07:02.607]                         self.assertEqual(result["username"], expected)
      [2026/10/29 11:07:02.607]                     elif opt == "password":
      [2026/10/29 11:07:02.607]                         self.assertEqual(result["password"], expected)
      [2026/10/29 11:07:02.607]                     elif opt == "auth_database" or opt == "db":
      [2026/10/29 11:07:02.607]                         self.assertEqual(result["database"], expected)
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]             hostname = next(iter(async_client_context.client.nodes))[0]
      [2026/10/29 11:07:02.607]             # The replica set members must be configured as 'localhost'.
      [2026/10/29 11:07:02.607]             if hostname == "localhost":
      [2026/10/29 11:07:02.607]                 copts = async_client_context.default_client_options.copy()
      [2026/10/29 11:07:02.607]                 # Remove tls since SRV parsing should add it automatically.
      [2026/10/29 11:07:02.607]                 copts.pop("tls", None)
      [2026/10/29 11:07:02.607]                 if async_client_context.tls:
      [2026/10/29 11:07:02.607]                     # Our test certs don't support the SRV hosts used in these
      [2026/10/29 11:07:02.607]                     # tests.
      [2026/10/29 11:07:02.607]                     copts["tlsAllowInvalidHostnames"] = True
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]                 client = self.simple_client(uri, **copts)
      [2026/10/29 11:07:02.607]                 if client._options.connect:
      [2026/10/29 11:07:02.607]                     await client.aconnect()
      [2026/10/29 11:07:02.607]                 if num_seeds is not None:
      [2026/10/29 11:07:02.607]                     self.assertEqual(len(client._topology_settings.seeds), num_seeds)
      [2026/10/29 11:07:02.607]                 if hosts is not None:
      [2026/10/29 11:07:02.607] >                   await async_wait_until(
      [2026/10/29 11:07:02.607]                         lambda: hosts == client.nodes, "match test hosts to client nodes"
      [2026/10/29 11:07:02.607]                     )
      [2026/10/29 11:07:02.607] test/asynchronous/test_dns.py:157: 
      [2026/10/29 11:07:02.607] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2026/10/29 11:07:02.607] predicate = <function create_test.<locals>.run_test.<locals>.<lambda> at 0x15ef368d0>
      [2026/10/29 11:07:02.607] success_description = 'match test hosts to client nodes', timeout = 10
      [2026/10/29 11:07:02.607]     async def async_wait_until(predicate, success_description, timeout=10):
      [2026/10/29 11:07:02.607]         """Wait up to 10 seconds (by default) for predicate to be true.
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         E.g.:
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]             wait_until(lambda: client.primary == ('a', 1),
      [2026/10/29 11:07:02.607]                        'connect to the primary')
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         If the lambda-expression isn't true after 10 seconds, we raise
      [2026/10/29 11:07:02.607]         AssertionError("Didn't ever connect to the primary").
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]         Returns the predicate's first true value.
      [2026/10/29 11:07:02.607]         """
      [2026/10/29 11:07:02.607]         start = time.time()
      [2026/10/29 11:07:02.607]         interval = min(float(timeout) / 100, 0.1)
      [2026/10/29 11:07:02.607]         while True:
      [2026/10/29 11:07:02.607]             if iscoroutinefunction(predicate):
      [2026/10/29 11:07:02.607]                 retval = await predicate()
      [2026/10/29 11:07:02.607]             else:
      [2026/10/29 11:07:02.607]                 retval = predicate()
      [2026/10/29 11:07:02.607]             if retval:
      [2026/10/29 11:07:02.607]                 return retval
      [2026/10/29 11:07:02.607]     
      [2026/10/29 11:07:02.607]             if time.time() - start > timeout:
      [2026/10/29 11:07:02.607] >               raise AssertionError("Didn't ever %s" % success_description)
      [2026/10/29 11:07:02.607] E               AssertionError: Didn't ever match test hosts to client nodes
      [2026/10/29 11:07:02.607] test/asynchronous/utils.py:82: AssertionError
      

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

              Created:
              Updated:
              Resolved: