Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-97567

Simplify network mocking

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • 200

      The primary way of mocking network responses is through NetworkInterfaceMock, which is provided to the task executors used in various tests (the ShardingTestFixture is one such example). The NetworkInterfaceMock allows for fully deterministic simulations of the networking reactor thread and its sequencing with ThreadPoolTaskExecutor's executor thread, but as a result using it is quite difficult. In particular, the requirement to explicitly move the networking thread forward in the unittest main thread often bleeds implementations details of the TaskExecutor or its users to the test. For example, many tests needed to be updated to do so as a result of an internal refactor to ThreadPoolTaskExecutor in SERVER-93114 (see here).

      We should provide a simpler way to use NetworkInterfaceMock, or introduce a simpler networking mock altogether for use in new tests.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: