Restructure DocumentSources and their tests.

XMLWordPrintableJSON

    • Fully Compatible
    • Query 2016-10-31
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: