[SERVER-3354] Unable re-run smoke tests as different user since fixed path is used for test database Created: 01/Jul/11  Updated: 07/Mar/18  Resolved: 07/Mar/18

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: 1.8.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Rob Hebron Assignee: DO NOT USE - Backlog - Test Infrastructure Group (TIG)
Resolution: Done Votes: 0
Labels: tig-resmoke
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Debian linux (Squeeze)


Operating System: Linux
Participants:

 Description   

The test suite writes its database to a fixed path of /tmp/unittests. If these are run as one user, and then another user tries to run the tests (as may happen on a shared build server), the tests fail as access to /tmp/unittests is denied. Use of the --smokedbprefix does not alter the location in which the test database is created.



 Comments   
Comment by Max Hirschhorn [ 07/Mar/18 ]

The --dbpathPrefix option or the TMPDIR environment variable can also be used with resmoke.py.

@staticmethod
def _get_dbpath_prefix():
    """
    Returns the prefix of the dbpath to use for the dbtest
    executable.
    Order of preference:
        1. The --dbpathPrefix specified at the command line.
        2. Value of the TMPDIR environment variable.
        3. Value of the TEMP environment variable.
        4. Value of the TMP environment variable.
        5. The /tmp directory.
    """
 
    if config.DBPATH_PREFIX is not None:
        return config.DBPATH_PREFIX
 
    for env_var in ("TMPDIR", "TEMP", "TMP"):
        if env_var in os.environ:
            return os.environ[env_var]
    return os.path.normpath("/tmp")

https://github.com/mongodb/mongo/blob/r3.7.2/buildscripts/resmokelib/testing/testcases/dbtest.py#L77-L97

Comment by Eliot Horowitz (Inactive) [ 03/Sep/11 ]

Note: you can use test --dbpath <foo>

Generated at Thu Feb 08 03:02:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.