Remove duplicate source files across different test targets

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Critical - P2
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Build
    • Fully Compatible
    • ALL
    • Hide

      I've been using

      bazel run +session_test

      most often, but in my experience running any C++ unit test locally will result in this error.

      Show
      I've been using bazel run +session_test most often, but in my experience running any C++ unit test locally will result in this error.
    • None
    • 0
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In BUILD.bazel, "sharding_ddl_coordinator_external_state_for_test.cpp" is included both in db_s_shard_server_part2_test and db_s_shard_server_part3_test . Similarily, "//src/mongo/db/s/resharding:resharding_test_util.cpp" is included in both db_s_resharding_test and db_s_resharding_part2_test .

      plus_interface.py does not allow the same source file to be included in multiple test targets. Now, each attempt to run a C++ unit test locally results in the following error:

      (python3-venv) ubuntu@ip-10-0-114-28:~/workspace/mongo$ bazel run +session_test
      Traceback (most recent call last):
        File "/home/ubuntu/workspace/mongo/bazel/wrapper_hook/wrapper_hook.py", line 61, in <module>
          main()
        File "/home/ubuntu/workspace/mongo/bazel/wrapper_hook/wrapper_hook.py", line 45, in main
          args = test_runner_interface(
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/ubuntu/workspace/mongo/bazel/wrapper_hook/plus_interface.py", line 147, in test_runner_interface
          add_source_test(src, binfile, sources_to_bin)
        File "/home/ubuntu/workspace/mongo/bazel/wrapper_hook/plus_interface.py", line 129, in add_source_test
          raise DuplicateSourceNames(
      bazel.wrapper_hook.plus_interface.DuplicateSourceNames: Two test files with the same name:
        //src/mongo/db/s:db_s_shard_server_part3_test->sharding_ddl_coordinator_external_state_for_test
        //src/mongo/db/s:db_s_shard_server_part2_test->sharding_ddl_coordinator_external_state_for_test
      

      The script did not run on evergreen, allowing these changes to be merged into master in this PR.

      Duplicate source files should be removed from test targets.

      A separate ticket has been filed to run this script on evergreen.

              Assignee:
              Steve McClure
              Reporter:
              Tymoteusz Ślepowroński
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: