SERVER-123900 Block running failing MozJS tests against a WASM-enabled server (#52296)
Co-authored-by: Gregory Noma <gregory.noma@gmail.com> Co-authored-by: Alyssa Clark <alyssa.clark@mongodb.com> Co-authored-by: Thomas Goyne <thomas.goyne@mongodb.com> Co-authored-by: Philip Stoev <philip.stoev@mongodb.com> Co-authored-by: Joan Bruguera Micó (at MongoDB) <joan.bruguera-mico@mongodb.com> Co-authored-by: Matthew Boros <mattBoros@users.noreply.github.com> Co-authored-by: Finley Lau <finley.lau@mongodb.com> Co-authored-by: Daniel Moody <dmoody256@gmail.com> Co-authored-by: Ted Tuckman <TedTuckman@users.noreply.github.com> Co-authored-by: Yuhong Zhang <yuhong.zhang@mongodb.com> Co-authored-by: Copilot <copilot@github.com> GitOrigin-RevId: 0a318ad31b0a7881549f93fb6bc0dd4cb57934e3
This commit is contained in:
parent
266b70c6af
commit
01e4be59eb
@ -496,6 +496,10 @@ EVERGREEN_REQUESTER = 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
|
||||
|
||||
# If set, the listed file paths will be excluded from the suite(s) regardless of tags.
|
||||
# Populated at startup (e.g. to exclude MozJS-containing jstestfuzz files on mozjs-wasm servers).
|
||||
EXCLUDE_FILES = None
|
||||
|
||||
# Allow test files passed as positional args to run even if they are excluded on the suite config.
|
||||
FORCE_EXCLUDED_TESTS = None
|
||||
|
||||
@ -901,6 +905,11 @@ REQUIRES_WORKLOAD_CONTAINER_SETUP = False
|
||||
# Config fuzzer encryption options, this is only set when the fuzzer is run
|
||||
CONFIG_FUZZER_ENCRYPTION_OPTS = None
|
||||
|
||||
# Indicates which JavaScript engine the tested binary was built with. Corresponds to the
|
||||
# "javascriptEngine" field returned by the buildInfo command (or --version). When set to
|
||||
# "mozjs-wasm", tests tagged with "mozjs_wasm_unsupported" will be excluded.
|
||||
JS_ENGINE = None
|
||||
|
||||
# If resmoke is running on a build variant that specifies a mongo_mozjs_opts,
|
||||
# we need a way to provide the JS_GC_ZEAL setting provided as part of the mongo_mozjs_opts
|
||||
# exclusively to mongod/mongos.
|
||||
|
||||
@ -5,11 +5,13 @@ import collections
|
||||
import configparser
|
||||
import datetime
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import os.path
|
||||
import platform
|
||||
import random
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
@ -776,6 +778,14 @@ flags in common: {common_set}
|
||||
|
||||
_config.MONGOD_EXECUTABLE = _expand_user(config.pop("mongod_executable"))
|
||||
|
||||
# TODO SERVER-116054, SERVER-116052, SERVER-116055, SERVER-116053: Remove this js_engine handling
|
||||
# section and_detect_js_engine once mozjs-wasm supports $where, $function, $accumulator, and
|
||||
# mapReduce, eliminating the need for this startup-time binary invocation.
|
||||
_config.JS_ENGINE = _detect_js_engine(_config.MONGOD_EXECUTABLE)
|
||||
if _config.JS_ENGINE == "mozjs-wasm":
|
||||
_config.EXCLUDE_WITH_ANY_TAGS.append("mozjs_wasm_unsupported")
|
||||
_config.EXCLUDE_FILES = _find_mozjs_jstestfuzz_files()
|
||||
|
||||
mongod_set_parameters = config.pop("mongod_set_parameters")
|
||||
|
||||
_config.MONGOD_SET_PARAMETERS = _merge_set_params(mongod_set_parameters)
|
||||
@ -1180,6 +1190,71 @@ def _set_logging_config():
|
||||
raise IOError("Directory {} does not exist.".format(_config.LOGGER_DIR))
|
||||
|
||||
|
||||
_MOZJS_PATTERNS = (
|
||||
# TODO SERVER-116052: Add support for $function.
|
||||
'"$function"',
|
||||
# TODO SERVER-116053: Add support for mapReduce.
|
||||
"mapReduce",
|
||||
"mapreduce",
|
||||
# TODO SERVER-116054: Add support for $where.
|
||||
'"$where"',
|
||||
# TODO SERVER-116055: Add support for $accumulator.
|
||||
'"$accumulator"',
|
||||
)
|
||||
|
||||
|
||||
def _find_mozjs_jstestfuzz_files() -> list[str]:
|
||||
"""Return paths of jstestfuzz output files that contain MozJS-dependent operations.
|
||||
|
||||
Scans all files under jstestfuzz/out/ and excludes any that reference $function, $where,
|
||||
$accumulator, or mapReduce — operators that require the MozJS JavaScript engine and fail
|
||||
on a mozjs-wasm server.
|
||||
"""
|
||||
excluded = []
|
||||
for path in glob.glob("jstestfuzz/out/*.js"):
|
||||
try:
|
||||
content = Path(path).read_text(encoding="utf-8")
|
||||
except OSError:
|
||||
continue
|
||||
if any(pattern in content for pattern in _MOZJS_PATTERNS):
|
||||
excluded.append(path)
|
||||
return excluded
|
||||
|
||||
|
||||
def _detect_js_engine(mongod_executable: Optional[str]) -> Optional[str]:
|
||||
"""Return the JS engine name reported by the mongod binary, or None if the binary does not exist
|
||||
or it cannot be determined (i.e. --version does not output javascriptEngine).
|
||||
|
||||
Runs ``mongod --version`` and parses the ``javascriptEngine`` field from the Build Info JSON.
|
||||
If the binary exists, returns e.g. ``"mozjs"`` or ``"mozjs-wasm"``, or ``none``.
|
||||
Note that ''none'' is a valid JS engine that indicates the server was built without a JS engine,
|
||||
and is not the same as returning None to indicate the binary doesn't exist.
|
||||
|
||||
When ``mongod_executable`` is not specified, falls back to the default executable name
|
||||
(``"mongod"``), which may be resolved via PATH (e.g. via DEPS_PATH in the Bazel test runner).
|
||||
"""
|
||||
executable = mongod_executable or _config.DEFAULT_MONGOD_EXECUTABLE
|
||||
if shutil.which(executable) is None:
|
||||
return None
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[executable, "--version"],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10,
|
||||
)
|
||||
# The output is: "db version v...\nBuild Info: <pretty-printed JSON>\n"
|
||||
# Grab everything from "Build Info: " to the end and parse it as one JSON blob.
|
||||
marker = "Build Info:"
|
||||
idx = result.stdout.find(marker)
|
||||
if idx != -1:
|
||||
build_info = json.loads(result.stdout[idx + len(marker) :].strip())
|
||||
return build_info.get("javascriptEngine")
|
||||
except Exception: # pylint: disable=broad-except
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def _expand_user(pathname):
|
||||
"""Provide wrapper around os.path.expanduser() to do nothing when given None."""
|
||||
if pathname is None:
|
||||
|
||||
@ -512,7 +512,9 @@ class _SelectorConfig(object):
|
||||
self.roots = roots
|
||||
self.tag_file = tag_file
|
||||
self.include_files = utils.default_if_none(include_files, [])
|
||||
self.exclude_files = utils.default_if_none(exclude_files, [])
|
||||
self.exclude_files = list(
|
||||
set(utils.default_if_none(exclude_files, [])) | set(config.EXCLUDE_FILES or [])
|
||||
)
|
||||
include_with_any_tags = self.__merge_lists(
|
||||
include_with_any_tags, config.INCLUDE_WITH_ANY_TAGS
|
||||
)
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
// @tags: [
|
||||
// requires_scripting,
|
||||
// resource_intensive,
|
||||
// # TODO SERVER-116055: Add support for $accumulate.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
const coll = db.accumulator_js_size_limits;
|
||||
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
// recursion' error and does not crash the server.
|
||||
// @tags: [
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116052: Add support for $function.
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
import {FixtureHelpers} from "jstests/libs/fixture_helpers.js";
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
* requires_sharding,
|
||||
* uses_transactions,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116052: Add support for $function.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
/**
|
||||
* @tags: [
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
// Test for SERVER-9129
|
||||
|
||||
@ -15,7 +15,9 @@
|
||||
* does_not_support_stepdowns,
|
||||
* # TODO (SERVER-91002): server side javascript execution is deprecated, and the balancer is not
|
||||
* # compatible with it, once the incompatibility is taken care off we can re-enable this test
|
||||
* assumes_balancer_off
|
||||
* assumes_balancer_off,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {extendWorkload} from "jstests/concurrency/fsm_libs/extend_workload.js";
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
* requires_getmore,
|
||||
* # TODO: SERVER-119660 Ensure server_status_with_time_out_cursors.js does not leak cursors.
|
||||
* can_leak_idle_cursors,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
export const $config = (function () {
|
||||
|
||||
@ -20,6 +20,8 @@
|
||||
* requires_scripting,
|
||||
* # Tests currentOp behavior that is different between 8.1 and previous verions.
|
||||
* requires_fcv_81,
|
||||
* # TODO SERVER-116052: Add support for $function.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
// requires_profiling,
|
||||
// # Uses $where operation.
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
// We turn off gossiping the mongo shell's clusterTime because it causes the slow command log
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
// # Time series collections (as views) generate different profiling/plan
|
||||
// # summary entries (e.g. distinct from underlying bucket collection).
|
||||
// exclude_from_timeseries_crud_passthrough,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
let coll = db.count10;
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
// # Primary-driven index builds must have batched writes enabled which config.image_collection
|
||||
// # does not support.
|
||||
// primary_driven_index_builds_incompatible_with_retryable_writes,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
// Ensures that find and modify will not apply an update to a document which, due to a concurrent
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
// requires_non_retryable_writes,
|
||||
// # Uses $where operator
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
let t = db.jstests_js1;
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
// # Uses $where operator
|
||||
// requires_scripting,
|
||||
// requires_getmore,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
let t = db.jstests_js4;
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
// # Uses $where operator
|
||||
// requires_scripting,
|
||||
// requires_getmore,
|
||||
// # TODO SERVER-116052: Add support for $function.
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
// Note: It's important to use our own database here to avoid sharing a javascript execution context
|
||||
// (Scope) with other tests which could pollute the global scope. This context is cached and shared
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
// # Uses mapReduce command.
|
||||
// requires_scripting,
|
||||
// requires_getmore,
|
||||
// # TODO SERVER-116052: Add support for $function.
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
import {resultsEq} from "jstests/aggregation/extras/utils.js";
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
// requires_scripting,
|
||||
// # Time-series collections are views which don't support map-reduce
|
||||
// exclude_from_timeseries_crud_passthrough,
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
// Takes a list of constructors and returns a new list with an extra entry for each constructor with
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
// uses_map_reduce_with_temp_collections,
|
||||
// requires_scripting,
|
||||
// multiversion_incompatible,
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
/**
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
// does_not_support_stepdowns,
|
||||
// uses_map_reduce_with_temp_collections,
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
const coll = db.mr_fail_invalid_js;
|
||||
const outputColl = db.mr_fail_invalid_js_out;
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
* does_not_support_causal_consistency,
|
||||
* does_not_support_stepdowns,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
let coll = db.mr_tolerates_js_exception;
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
// assumes_balancer_off,
|
||||
// # Uses $where operator
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// assumes_read_concern_local,
|
||||
// requires_getmore,
|
||||
// # TODO(SERVER-84158): Try to include this test(s).
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
// requires_scripting,
|
||||
// # Time-series collections are views which don't support map-reduce
|
||||
// exclude_from_timeseries_crud_passthrough,
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
db.recursion.drop();
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
*
|
||||
* @tags: [
|
||||
* requires_fcv_60,
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116052: Add support for $function.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
// assumes_balancer_off,
|
||||
// # TODO(SERVER-84158): Try to include this test(s).
|
||||
// exclude_from_timeseries_crud_passthrough,
|
||||
// # TODO SERVER-116052: Add support for $function.
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// # TODO SERVER-116055: Add support for $accumulate.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
const testDB = db.getSiblingDB("system_js_access");
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
* assumes_balancer_off,
|
||||
* # TODO(SERVER-84158): Try to include this test(s).
|
||||
* exclude_from_timeseries_crud_passthrough,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
const testDB = db.getSiblingDB(jsTestName());
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
* requires_fcv_63,
|
||||
* requires_scripting,
|
||||
* requires_getmore,
|
||||
* # TODO SERVER-116052: Add support for $function.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
/**
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// @tags: [
|
||||
// # Uses $where operator
|
||||
// requires_scripting
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
let t = db.where3;
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
// # Uses $where operator
|
||||
// requires_scripting,
|
||||
// requires_getmore,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
let t = db.where5;
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
* @tags: [
|
||||
* requires_non_retryable_commands,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
const collection = db.where_tolerates_js_exception;
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
// requires_scripting,
|
||||
// # TODO(SERVER-84158): Try to include this test(s).
|
||||
// exclude_from_timeseries_crud_passthrough,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
function test() {
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
* @tags: [
|
||||
* # Uses $where operator
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
* @tags: [
|
||||
* requires_sharding,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {FixtureHelpers} from "jstests/libs/fixture_helpers.js";
|
||||
|
||||
@ -2,6 +2,11 @@
|
||||
* Tests various connection timeouts in and below the NetworkInterface layer return with
|
||||
* different error codes. The fail points aim to mimic time outs in different locations, while
|
||||
* cluster `find` will use a higher level API that will retry on retryable error codes.
|
||||
*
|
||||
* @tags: [
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
|
||||
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
/**
|
||||
* @tags: [requires_fcv_63]
|
||||
* @tags: [
|
||||
* requires_fcv_63,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*
|
||||
* Tests that metrics related to connection acquisition timeout are reported correctly
|
||||
* in serverStatus.
|
||||
|
||||
@ -12,7 +12,13 @@
|
||||
// due to client disconnect, and the number of completed operations that couldn't return data
|
||||
// due to client disconnect.
|
||||
//
|
||||
// @tags: [requires_sharding, requires_scripting, grpc_incompatible]
|
||||
// @tags: [
|
||||
// requires_sharding,
|
||||
// requires_scripting,
|
||||
// grpc_incompatible,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
|
||||
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
/**
|
||||
* Tests where/function can be interrupted through maxTimeMS and query knob.
|
||||
* @tags: [
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116052: Add support for $function.
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
const mongodOptions = {};
|
||||
|
||||
@ -10,7 +10,9 @@
|
||||
* the shell.
|
||||
*
|
||||
* @tags: [
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
/**
|
||||
* Confirms that long-running transactions are logged once during their progress.
|
||||
* @tags: [requires_replication]
|
||||
* @tags: [
|
||||
* requires_replication,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
import {findSlowInProgressQueryLogLine} from "jstests/libs/log.js";
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
// See SERVER-9448
|
||||
// Test argument and receiver (aka 'this') objects and their children can be mutated
|
||||
// in Map, Reduce and Finalize functions
|
||||
// @tags: [requires_scripting]
|
||||
// @tags: [
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116053: Add support for mapReduce.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
import {assertArrayEq} from "jstests/aggregation/extras/utils.js";
|
||||
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
||||
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
// Tests that planSummary is not duplicated in an active getmore currentOp entry.
|
||||
// This test runs a getMore in a parallel shell, which will not inherit the implicit session of
|
||||
// the cursor establishing command.
|
||||
//
|
||||
// @tags: [
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
TestData.disableImplicitSessions = true;
|
||||
|
||||
const collName = "currentop_plan_summary_no_dup";
|
||||
|
||||
@ -25,7 +25,13 @@
|
||||
* us to keep more tests running now. That said, these should ideally all throw so we do not rely on
|
||||
* the test itself calling assert.commandWorked.
|
||||
*
|
||||
* @tags: [requires_replication, uses_transactions, requires_scripting]
|
||||
* @tags: [
|
||||
* requires_replication,
|
||||
* uses_transactions,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
||||
|
||||
|
||||
@ -11,7 +11,9 @@
|
||||
* requires_replication,
|
||||
* requires_getmore,
|
||||
* requires_fcv_62,
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
// @tags: [requires_fast_memory]
|
||||
// @tags: [
|
||||
// requires_fast_memory,
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
const conn = MongoRunner.runMongod({});
|
||||
assert.neq(null, conn, "unable to start mongod");
|
||||
const db = conn.getDB("memory_test");
|
||||
|
||||
@ -7,7 +7,9 @@
|
||||
// - Tests fsync and fsync+lock permissions on sharded db
|
||||
// @tags: [
|
||||
// expects_explicit_underscore_id_index,
|
||||
// requires_scripting
|
||||
// requires_scripting,
|
||||
// # TODO SERVER-116054: Add support for $where.
|
||||
// mozjs_wasm_unsupported,
|
||||
// ]
|
||||
|
||||
import {ShardingTest} from "jstests/libs/shardingtest.js";
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
*
|
||||
* @tags: [
|
||||
* multiversion_incompatible,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {MongosAPIParametersUtil} from "jstests/sharding/libs/mongos_api_params_util.js";
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
*
|
||||
* @tags: [
|
||||
* multiversion_incompatible,
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
import {MongosAPIParametersUtil} from "jstests/sharding/libs/mongos_api_params_util.js";
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
/**
|
||||
* @tags: [
|
||||
* requires_scripting
|
||||
* requires_scripting,
|
||||
* # TODO SERVER-116053: Add support for mapReduce.
|
||||
* # TODO SERVER-116054: Add support for $where.
|
||||
* mozjs_wasm_unsupported,
|
||||
* ]
|
||||
*/
|
||||
|
||||
|
||||
@ -120,6 +120,56 @@ void exitWithError(const int statusCode, const std::string& msg) {
|
||||
std::exit(statusCode);
|
||||
}
|
||||
|
||||
// Recursively scans a BSON object for operators that require the MozJS JavaScript engine.
|
||||
// Operators checked (will be removed from this check in the future when mozjs-wasm supports them):
|
||||
// TODO SERVER-116054: Add support for $where.
|
||||
// TODO SERVER-116052: Add support for $function.
|
||||
// TODO SERVER-116055: Add support for $accumulator.
|
||||
// TODO SERVER-116053: Add support for mapReduce.
|
||||
bool containsUnsupportedJSWasmOperators(const BSONObj& obj) {
|
||||
for (const auto& elem : obj) {
|
||||
const auto fieldName = elem.fieldNameStringData();
|
||||
if (fieldName == "$where"_sd || fieldName == "$function"_sd ||
|
||||
fieldName == "$accumulator"_sd || fieldName == "mapReduce"_sd ||
|
||||
fieldName == "mapreduce"_sd) {
|
||||
return true;
|
||||
}
|
||||
if (elem.type() == BSONType::object || elem.type() == BSONType::array) {
|
||||
if (containsUnsupportedJSWasmOperators(elem.Obj())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determines if a query file should be skipped.
|
||||
bool shouldSkipFile(const QueryFile& currFile, DBClientConnection* conn) {
|
||||
if (!conn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the server is running mozjs-wasm, we need to check if any queries contain MozJS
|
||||
// operators, and if so, skip the file since those queries won't run successfully.
|
||||
// TODO SERVER-116054, SERVER-116052, SERVER-116055, SERVER-116053: Remove this check once
|
||||
// mozjs-wasm supports all MozJS operators used in the test files.
|
||||
static constexpr auto kMozJsWasmEngine = "mozjs-wasm"_sd;
|
||||
auto bob = BSONObjBuilder{};
|
||||
bob.append("buildInfo", 1);
|
||||
const auto buildInfo = runCommand(conn, "admin", bob.done());
|
||||
if (buildInfo.getStringField("javascriptEngine") == kMozJsWasmEngine) {
|
||||
for (const auto& test : currFile.getTests()) {
|
||||
if (containsUnsupportedJSWasmOperators(test.getQuery())) {
|
||||
std::cout << "Skipping " << currFile.getFilePath().string()
|
||||
<< " (contains MozJS queries; server uses mozjs-wasm)" << std::endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int runTestProgram(const std::vector<TestSpec> testsToRun,
|
||||
const std::string& uriString,
|
||||
const bool dropData,
|
||||
@ -153,6 +203,13 @@ int runTestProgram(const std::vector<TestSpec> testsToRun,
|
||||
// Treat data load errors as failures, too.
|
||||
try {
|
||||
currFile.readInEntireFile(mode, startRange, endRange);
|
||||
|
||||
// Skip files requiring MozJS when running against a mozjs-wasm server. populateAndExit
|
||||
// mode is excluded since collection setup should proceed regardless.
|
||||
if (!populateAndExit && shouldSkipFile(currFile, conn.get())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
currFile.loadCollections(conn.get(),
|
||||
dropData,
|
||||
loadData,
|
||||
|
||||
@ -135,6 +135,10 @@ boost::optional<std::string> Test::getErrorMessage() const {
|
||||
return _errorMessage;
|
||||
}
|
||||
|
||||
const BSONObj& Test::getQuery() const {
|
||||
return _query;
|
||||
}
|
||||
|
||||
std::vector<std::string> Test::normalize(const std::vector<BSONObj>& objs,
|
||||
const NormalizationOptsSet opts) {
|
||||
const auto numResults = objs.size();
|
||||
|
||||
@ -83,6 +83,8 @@ public:
|
||||
|
||||
boost::optional<std::string> getErrorMessage() const;
|
||||
|
||||
const BSONObj& getQuery() const;
|
||||
|
||||
/**
|
||||
* Compute the normalized version of the input set.
|
||||
*/
|
||||
|
||||
@ -277,6 +277,10 @@ const std::vector<CollectionSpec>& QueryFile::getCollectionsNeeded() const {
|
||||
return _collectionsNeeded;
|
||||
}
|
||||
|
||||
const std::filesystem::path& QueryFile::getFilePath() const {
|
||||
return _filePath;
|
||||
}
|
||||
|
||||
size_t QueryFile::getFailedQueryCount() const {
|
||||
return _failedQueryCount;
|
||||
}
|
||||
@ -289,6 +293,10 @@ const std::string& QueryFile::getQuery(const size_t testNum) const {
|
||||
return _testNumToQuery.at(testNum);
|
||||
}
|
||||
|
||||
const std::vector<Test>& QueryFile::getTests() const {
|
||||
return _tests;
|
||||
}
|
||||
|
||||
void QueryFile::loadCollections(DBClientConnection* const conn,
|
||||
const bool dropData,
|
||||
const bool loadData,
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "mongo/stdx/unordered_map.h"
|
||||
#include "mongo/util/modules.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -80,9 +81,11 @@ public:
|
||||
|
||||
std::string generateFailureReport() const;
|
||||
const std::vector<CollectionSpec>& getCollectionsNeeded() const;
|
||||
const std::filesystem::path& getFilePath() const;
|
||||
size_t getFailedQueryCount() const;
|
||||
size_t getTestsRun() const;
|
||||
const std::string& getQuery(size_t testNum) const;
|
||||
const std::vector<Test>& getTests() const;
|
||||
|
||||
/**
|
||||
* Loads or drops then loads the collections needed for the test files depending on the passed
|
||||
@ -126,6 +129,7 @@ public:
|
||||
void printFailedQueries(const std::set<size_t>& failedTestNums) const;
|
||||
|
||||
bool readInEntireFile(ModeOption, size_t = kMinTestNum, size_t = kMaxTestNum);
|
||||
|
||||
void runTestFile(DBClientConnection*, ModeOption);
|
||||
|
||||
/**
|
||||
|
||||
@ -156,6 +156,7 @@ void VersionInfoInterface::logBuildInfo(std::ostream* os) const {
|
||||
#endif
|
||||
bob.append("modules", modules());
|
||||
bob.append("allocator", allocator());
|
||||
bob.append("javascriptEngine", jsEngine());
|
||||
{
|
||||
auto envObj = BSONObjBuilder(bob.subobjStart("environment"));
|
||||
for (auto&& bi : buildInfo())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user