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

ClusterCommandTestFixture is hard to use for writing unit tests

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Catalog and Routing
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None

      ClusterCommandTestFixture is a test fixture that lets us implement C++ unit tests that exercise router code by mocking responses from the shards. It's super useful for testing code changes without having to write a JS test.

      Despite its utility, from personal experience, this fixture makes it challenging to write tests, since the test can hang quite easily:

      • If the test queues up mock shard responses that are never consumed by the router, the test hangs. Note that this is true even if router code throws an exception, and the exception is not surfaced.
      • If the test doesn't queue up enough shard responses, then the test will hang.

      It would be great to show this fixture some love. Even just adding a timeout to the fixture would help a lot with writing tests.

            Assignee:
            Unassigned Unassigned
            Reporter:
            chris.wolff@mongodb.com Chris Wolff
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: