summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2018-09-27 16:59:46 -0400
committerJonathan Abrahams <jonathan@mongodb.com>2018-10-03 15:22:30 -0400
commitb665d7a575ca08c6d6157f35f2d4bb6bf38a8388 (patch)
treeb72b6840c676bb77d6aaf3cc73d2dd37611fc09a /buildscripts
parent58501015eff7961dc378abe1d49e064a3dcf3dbc (diff)
downloadmongo-b665d7a575ca08c6d6157f35f2d4bb6bf38a8388.tar.gz
SERVER-33853 Define a new test tag, test_disabled, to temporarily disable a test
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/resmokelib/config.py3
-rw-r--r--buildscripts/resmokelib/parser.py9
-rw-r--r--buildscripts/tests/resmokelib/test_selector.py22
3 files changed, 32 insertions, 2 deletions
diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py
index d797785ecab..a9280428d75 100644
--- a/buildscripts/resmokelib/config.py
+++ b/buildscripts/resmokelib/config.py
@@ -260,6 +260,9 @@ EVERGREEN_VERSION_ID = None
# If set, then any jstests that have any of the specified tags will be excluded from the suite(s).
EXCLUDE_WITH_ANY_TAGS = None
+# A tag which is implicited excluded. This is useful for temporarily disabling a test.
+EXCLUDED_TAG = "__TEMPORARILY_DISABLED__"
+
# If true, then a test failure or error will cause resmoke.py to exit and not run any more tests.
FAIL_FAST = None
diff --git a/buildscripts/resmokelib/parser.py b/buildscripts/resmokelib/parser.py
index fd92055c1da..83c5c26ff76 100644
--- a/buildscripts/resmokelib/parser.py
+++ b/buildscripts/resmokelib/parser.py
@@ -73,7 +73,9 @@ def _make_parser(): # pylint: disable=too-many-statements
parser.add_option("--excludeWithAnyTags", action="append", dest="exclude_with_any_tags",
metavar="TAG1,TAG2",
help=("Comma separated list of tags. Any jstest that contains any of the"
- " specified tags will be excluded from any suites that are run."))
+ " specified tags will be excluded from any suites that are run."
+ " The tag '{}' is implicitly part of this list.".format(
+ _config.EXCLUDED_TAG)))
parser.add_option("-f", "--findSuites", action="store_true", dest="find_suites",
help="Lists the names of the suites that will execute the specified tests.")
@@ -387,7 +389,10 @@ def _update_config_vars(values): # pylint: disable=too-many-statements
_config.DBPATH_PREFIX = _expand_user(config.pop("dbpath_prefix"))
_config.DBTEST_EXECUTABLE = _expand_user(config.pop("dbtest_executable"))
_config.DRY_RUN = config.pop("dry_run")
- _config.EXCLUDE_WITH_ANY_TAGS = _tags_from_list(config.pop("exclude_with_any_tags"))
+ # EXCLUDE_WITH_ANY_TAGS will always contain the implicitly defined EXCLUDED_TAG.
+ _config.EXCLUDE_WITH_ANY_TAGS = [_config.EXCLUDED_TAG]
+ _config.EXCLUDE_WITH_ANY_TAGS.extend(
+ utils.default_if_none(_tags_from_list(config.pop("exclude_with_any_tags")), []))
_config.FAIL_FAST = not config.pop("continue_on_failure")
_config.INCLUDE_WITH_ANY_TAGS = _tags_from_list(config.pop("include_with_any_tags"))
_config.JOBS = config.pop("jobs")
diff --git a/buildscripts/tests/resmokelib/test_selector.py b/buildscripts/tests/resmokelib/test_selector.py
index edba22ba7b3..852272aecee 100644
--- a/buildscripts/tests/resmokelib/test_selector.py
+++ b/buildscripts/tests/resmokelib/test_selector.py
@@ -5,6 +5,7 @@ from __future__ import absolute_import
import fnmatch
import unittest
+import buildscripts.resmokelib.parser as parser
import buildscripts.resmokelib.selector as selector
import buildscripts.resmokelib.utils.globstar as globstar
import buildscripts.resmokelib.config
@@ -497,6 +498,27 @@ class TestFilterTests(unittest.TestCase):
selected)
self.assertEqual(["dir/subdir1/test11.js"], excluded)
+ def test_jstest_exclude_with_any_tags(self):
+ config = {
+ "roots": ["dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js"],
+ "exclude_with_any_tags": ["tag2"]
+ }
+ selected, excluded = selector.filter_tests("js_test", config, self.test_file_explorer)
+ self.assertEqual(["dir/subdir1/test11.js", "dir/subdir2/test21.js"], excluded)
+ self.assertEqual(["dir/subdir1/test12.js", "dir/subdir3/a/test3a1.js"], selected)
+
+ def test_filter_temporarily_disabled_tests(self):
+ parser.parse_command_line()
+ test_file_explorer = MockTestFileExplorer()
+ test_file_explorer.tags = {
+ "dir/subdir1/test11.js": ["tag1", "tag2", "__TEMPORARILY_DISABLED__"],
+ "dir/subdir1/test12.js": ["tag3"], "dir/subdir2/test21.js": ["tag2", "tag4"]
+ }
+ config = {"roots": ["dir/subdir1/*.js", "dir/subdir2/*.js"]}
+ selected, excluded = selector.filter_tests("js_test", config, test_file_explorer)
+ self.assertEqual(["dir/subdir1/test11.js"], excluded)
+ self.assertEqual(["dir/subdir1/test12.js", "dir/subdir2/test21.js"], selected)
+
def test_jstest_force_include(self):
config = {
"roots": ["dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js"],