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

Restructure DocumentSources and their tests.

    • Fully Compatible
    • Query 2016-10-31

      We currently have a bit of a weird setup of DocumentSources and their unit tests:

      1. All DocumentSources are declared within the same header file: src/mongo/db/pipeline/document_source.h. This isn't so bad, but makes it harder to jump back and forth between the header and the cpp file.
      2. Each DocumentSource implementation is declared in its own file, e.g. src/mongo/db/pipeline/document_source_match.cpp.
      3. All unit tests live in one file: src/mongo/db/pipeline/document_source_test.cpp, but each implementation has it's own namespace, with some common types of tests in each namespace, sometimes with identical names. This is quite annoying to navigate.
      4. Since SERVER-19542 was resolved, some tests in src/mongo/db/pipeline/pipeline_test.cpp are testing functionality that is now the responsibility of the DocumentSource itself.

      We should resolve these discrepancies by adding a separate header file and test file for each DocumentSource, and moving the tests from pipeline to the new test files as appropriate. It may be worthwhile to create a sub-directory within src/mongo/db/pipeline for DocumentSources.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: