resmoke.py fails when path to the checkout of server repo contains the "-" character

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • DevProd Correctness
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 0

      I encountered this issue while doing some development work against the 8.0 branch of the server. In order to isolate my build of 8.0 from other in-progress work I have against the master branch, I created a new clone of the 10gen/mongo repository like so:

      git clone git@github.com:10gen/mongo.git mongo-v80
      

      Then I created a build of the server as usual and issued the following resmoke.py command:

      python3 buildscripts/resmoke.py run --suites=query_golden_classic
      

      This failed with the following error:

      [executor] 00:32:44.336Z Starting execution of js_tests...
      [executor:js_test:job0] 00:32:44.337Z Running job0_fixture_setup_0...
      [js_test:job0_fixture_setup_0] Starting the setup of MongoDFixture (Job #0).
      [js_test:job0_fixture_setup_0] An error occurred during the setup of MongoDFixture (Job #0).
      Traceback (most recent call last):
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/testing/testcases/fixture.py", line 41, in run_test
          self.fixture.setup()
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/testing/fixtures/standalone.py", line 100, in setup
          mongod, _ = launcher.launch_mongod_program(self.logger, self.job_num,
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/testing/fixtures/standalone.py", line 442, in launch_mongod_program
          return self.fixturelib.mongod_program(logger, job_num, executable, process_kwargs,
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/testing/fixtures/fixturelib.py", line 57, in mongod_program
          return core.programs.mongod_program(logger, job_num, executable, process_kwargs,
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/core/programs.py", line 118, in mongod_program
          remove_set_parameter_if_before_version(
        File "/home/ubuntu/mongo-v80/buildscripts/resmokelib/core/programs.py", line 69, in remove_set_parameter_if_before_version
          if version.parse(bin_version) < version.parse(required_bin_version):
        File "/home/ubuntu/mongo-v80/python3-venv/lib/python3.10/site-packages/packaging/version.py", line 54, in parse
          return Version(version)
        File "/home/ubuntu/mongo-v80/python3-venv/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
          raise InvalidVersion(f"Invalid version: '{version}'")
      packaging.version.InvalidVersion: Invalid version: 'v80/build/install/bin/mongod'
      

      It seems that this code deals incorrectly with the possibility that the path to the directory containing the mongod executable has a hyphen character. I was able to work around the problem by applying the diff below, but this code should probably be fixed so that developers are free to choose any name for the directory into which they clone the repo.

      diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py
      index d0c4dcfa5c9..db30e635631 100644
      --- a/buildscripts/resmokelib/core/programs.py
      +++ b/buildscripts/resmokelib/core/programs.py
      @@ -51,10 +51,10 @@ def get_binary_version(executable):
           # pylint: disable=wrong-import-position
           from buildscripts.resmokelib.multiversionconstants import LATEST_FCV
      
      -    split_executable = executable.split("-")
      -    version_regex = re.compile(version.VERSION_PATTERN, re.VERBOSE | re.IGNORECASE)
      -    if len(split_executable) > 1 and version_regex.match(split_executable[-1]):
      -        return split_executable[-1]
      +    #split_executable = executable.split("-")
      +    #version_regex = re.compile(version.VERSION_PATTERN, re.VERBOSE | re.IGNORECASE)
      +    #if len(split_executable) > 1 and version_regex.match(split_executable[-1]):
      +    #    return split_executable[-1]
           return LATEST_FCV
      
      
      

            Assignee:
            Unassigned
            Reporter:
            David Storch
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: