Fix missing await calls in async test suite

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Investigating ty's unused-awaitable rule (see
      https://gist.github.com/blink1073/a9fe43fbb2643b12ab4472836e77ee40) found 2 real
      missing-await bugs in test/asynchronous:
      * ResetPoolThread.run() (test_client.py) never awaits self._run(), so the
      pool-reset loop never executes during test_reset_during_update_pool.
      * InsertEventListener.succeeded() (test_retryable_writes.py) never awaits
      admin.command(...), so its configureFailPoint is never set.
      Both tests pass without exercising the behavior they're meant to test.

      mypy's unused-coroutine check should catch this but doesn't: mypy_test.ini
      disables no-untyped-def for test.*, and mypy skips body-checking on
      unannotated methods, which both of these are.

      Definition of done


      * Both bugs fixed; each test genuinely exercises its intended scenario
      * Full test suite passes, including the two affected tests

      Pitfalls


      * ResetPoolThread.run() needs more than await: Thread.run() has no
      running event loop, so it needs a real fix (e.g. dedicated loop in the thread, or
      drop the raw Thread)
      * Once the failpoint actually fires, test_retryable_writes.py may exercise a
      new code path, confirm it still passes and still tests what it intends

            Assignee:
            Unassigned
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: