mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-21 20:49:10 +01:00
SERVER-79896 Prevent load calls with linter rules
This commit is contained in:
parent
b9d16fece0
commit
6a27513025
@ -17,6 +17,14 @@ rules:
|
||||
no-redeclare: 0
|
||||
no-constant-condition: 0
|
||||
no-loss-of-precision: 0
|
||||
no-restricted-syntax: [
|
||||
'error',
|
||||
{
|
||||
message: "Invalid load call. Please convert your library to a module and import it instead.",
|
||||
selector:
|
||||
'CallExpression > Identifier[name="load"]'
|
||||
}
|
||||
]
|
||||
|
||||
globals:
|
||||
TestData: true
|
||||
|
@ -180,8 +180,8 @@ executor:
|
||||
config:
|
||||
shell_options:
|
||||
eval: >-
|
||||
load("jstests/libs/override_methods/retry_aborted_db_and_index_creation.js");
|
||||
load("jstests/libs/override_methods/implicitly_shard_accessed_collections.js");
|
||||
await import("jstests/libs/override_methods/retry_aborted_db_and_index_creation.js");
|
||||
await import("jstests/libs/override_methods/implicitly_shard_accessed_collections.js");
|
||||
hooks:
|
||||
- class: CheckReplDBHash
|
||||
- class: CheckMetadataConsistencyInBackground
|
||||
|
@ -134,7 +134,7 @@ executor:
|
||||
config:
|
||||
shell_options:
|
||||
eval: >-
|
||||
load("jstests/libs/override_methods/retry_aborted_db_and_index_creation.js");
|
||||
await import("jstests/libs/override_methods/retry_aborted_db_and_index_creation.js");
|
||||
hooks:
|
||||
- class: CheckReplDBHash
|
||||
- class: CheckMetadataConsistencyInBackground
|
||||
|
@ -405,7 +405,7 @@ functions:
|
||||
cat << EOF > mongodb/jstests/hooks/run_validate_collections.js
|
||||
print("NOTE: run_validate_collections.js will skip the oplog!");
|
||||
TestData = { skipValidationNamespaces: ['local.oplog.rs'] };
|
||||
load('jstests/hooks/run_validate_collections.actual.js');
|
||||
await import("jstests/hooks/run_validate_collections.actual.js");
|
||||
EOF
|
||||
fi
|
||||
tar czf mongodb${compile_variant|}.tar.gz mongodb
|
||||
|
@ -204,7 +204,8 @@ var getCompletions = function(prefix) {
|
||||
return __autocomplete__;
|
||||
};
|
||||
|
||||
var myNumberLong = new NumberLong();
|
||||
// assign `myNumberLong` to `globalThis` in case we are being run from another shell context.
|
||||
globalThis.myNumberLong = new NumberLong();
|
||||
var completions = getCompletions('myNumberLong.');
|
||||
assert(completions.indexOf('myNumberLong.floatApprox') >= 0);
|
||||
assert(completions.indexOf('myNumberLong.top') >= 0);
|
||||
|
@ -1,7 +1,7 @@
|
||||
const testFile = TestData.multiStmtTxnTestFile;
|
||||
|
||||
try {
|
||||
load(testFile);
|
||||
await import(testFile);
|
||||
} finally {
|
||||
// Run a lightweight command to allow the override file to commit the last command.
|
||||
// Ensure this command runs even if the test errors.
|
||||
|
@ -16,6 +16,7 @@ if (TestData.loadDepth >= 3) {
|
||||
}
|
||||
|
||||
try {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
load("jstests/noPassthrough/shell_load_file.js");
|
||||
} catch (e) {
|
||||
TestData.loadErrors.push(e);
|
||||
@ -35,4 +36,4 @@ for (let i = 0; i < TestData.loadErrors.length; ++i) {
|
||||
/@jstests\\noPassthrough\\shell_load_file.js:/.test(error.stack),
|
||||
() => "JavaScript stacktrace from load() didn't include file paths (AKA stack frames): " +
|
||||
error.stack);
|
||||
}
|
||||
}
|
||||
|
@ -150,9 +150,11 @@ tests.push(function testUncaughtExceptionInNativeCode() {
|
||||
|
||||
tests.push(function testUncaughtExceptionFromNestedThreads() {
|
||||
const thread = new Thread(function myFunction1() {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
load("jstests/libs/legacyThreadSupport.js");
|
||||
|
||||
const thread = new Thread(function myFunction2() {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
load("jstests/libs/legacyThreadSupport.js");
|
||||
|
||||
const thread = new Thread(function myFunction3() {
|
||||
|
@ -8,11 +8,7 @@ runs an fsyncLock which should fail and timeout as the global S lock cannot be t
|
||||
* ]
|
||||
*/
|
||||
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
load("jstests/libs/parallelTester.js");
|
||||
import {Thread} from "jstests/libs/parallelTester.js";
|
||||
|
||||
const st = new ShardingTest({
|
||||
shards: 2,
|
||||
@ -92,8 +88,5 @@ sleep(100);
|
||||
writeDecisionFp.off();
|
||||
|
||||
fsyncLockThread.join();
|
||||
|
||||
txnThread.join();
|
||||
|
||||
st.stop();
|
||||
})();
|
||||
|
@ -104,6 +104,7 @@ var ReplSetTest = function ReplSetTest(opts) {
|
||||
}
|
||||
|
||||
try {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
load("jstests/libs/legacyThreadSupport.js"); // For Thread.
|
||||
return true;
|
||||
} catch (e) {
|
||||
@ -3440,7 +3441,6 @@ var ReplSetTest = function ReplSetTest(opts) {
|
||||
print("ReplSetTest stopSet skipping validation before stopping nodes.");
|
||||
} else if (parallelValidate) {
|
||||
print("ReplSetTest stopSet validating all replica set nodes before stopping them.");
|
||||
print(` FOR PORTS: [${tojson(this.ports)}]`);
|
||||
this._validateNodes(this.ports);
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,7 @@ var ShardingTest = function ShardingTest(params) {
|
||||
}
|
||||
|
||||
try {
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
load("jstests/libs/legacyThreadSupport.js"); // For Thread.
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user