mirror of https://github.com/mongodb/mongo
SERVER-102469 Invert pass/fail default in linter shim (#33645)
GitOrigin-RevId: db8f10db669a747e3004e4032fae57ffd067d130
This commit is contained in:
parent
8ce82d9463
commit
d983587f36
|
|
@ -9,6 +9,5 @@ exports_files([
|
|||
sh_binary(
|
||||
name = "lint",
|
||||
srcs = ["lint.sh"],
|
||||
args = ["//..."],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,8 @@
|
|||
# placeholder for bazel/wrapper_hook/lint.py
|
||||
echo "No linter errors found!"
|
||||
if [[ $1 == "ALL_PASSING" ]]; then
|
||||
echo "No linter errors found!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Linter run failed, see details above"
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -186,25 +186,25 @@ def list_files_without_targets(
|
|||
return True
|
||||
|
||||
|
||||
def run_rules_lint(bazel_bin, args):
|
||||
def run_rules_lint(bazel_bin, args) -> bool:
|
||||
if platform.system() == "Windows":
|
||||
print("eslint not supported on windows")
|
||||
sys.exit(1)
|
||||
return False
|
||||
|
||||
if "--fix" in args:
|
||||
create_build_files_in_new_js_dirs()
|
||||
|
||||
files_with_targets = list_files_with_targets(bazel_bin)
|
||||
if not list_files_without_targets(files_with_targets, "C++", "cpp", ["src/mongo"]):
|
||||
sys.exit(1)
|
||||
return False
|
||||
|
||||
if not list_files_without_targets(
|
||||
files_with_targets, "javascript", "js", ["src/mongo", "jstests"]
|
||||
):
|
||||
sys.exit(1)
|
||||
return False
|
||||
|
||||
if not check_for_missing_test_stubs():
|
||||
exit(1)
|
||||
return False
|
||||
|
||||
# Default to linting everything if no path was passed in
|
||||
if len([arg for arg in args if not arg.startswith("--")]) == 0:
|
||||
|
|
@ -313,6 +313,7 @@ def run_rules_lint(bazel_bin, args):
|
|||
)
|
||||
else:
|
||||
print(f"ERROR: unknown fix type {fix}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
return False
|
||||
elif failing_reports != 0:
|
||||
sys.exit(1)
|
||||
return False
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ def test_runner_interface(args, autocomplete_query, get_buildozer_output=get_bui
|
|||
|
||||
if lint_target:
|
||||
command_start_index = args.index("lint") + 1
|
||||
run_rules_lint(args[0], args[command_start_index:])
|
||||
if run_rules_lint(args[0], args[command_start_index:]):
|
||||
return ["run", "lint", "--", "ALL_PASSING"]
|
||||
return args[1:command_start_index]
|
||||
|
||||
if skip_plus_interface and not autocomplete_query:
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
const collName = jsTestName();
|
||||
const coll = db[collName];
|
||||
|
||||
coll.drop()
|
||||
assert.commandWorked(coll.insert({}))
|
||||
assert.commandWorked(coll.createIndex({t: 1, m: 1}))
|
||||
coll.drop();
|
||||
assert.commandWorked(coll.insert({}));
|
||||
assert.commandWorked(coll.createIndex({t: 1, m: 1}));
|
||||
assert.commandWorked(db.runCommand({
|
||||
aggregate: jsTestName(),
|
||||
pipeline:
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ function makePropertyFn(checkResultsFn, failMsg) {
|
|||
}
|
||||
}
|
||||
return {passed: true};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const {stageArb, checkResultsFn, failMsg} of testCases) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export function runTest(conn) {
|
|||
resource: {db: "release_memory_base_1", collection: "coll1"},
|
||||
actions: ["releaseMemoryAnyCursor"],
|
||||
}],
|
||||
})
|
||||
});
|
||||
admin.createRole({
|
||||
createRole: "releaseDatabase",
|
||||
roles: ["readAnyDatabase"],
|
||||
|
|
@ -78,12 +78,12 @@ export function runTest(conn) {
|
|||
resource: {db: "release_memory_base_1", collection: ""},
|
||||
actions: ["releaseMemoryAnyCursor"],
|
||||
}],
|
||||
})
|
||||
});
|
||||
admin.createRole({
|
||||
createRole: "releaseCluster",
|
||||
roles: ["readAnyDatabase"],
|
||||
privileges: [{resource: {cluster: true}, actions: ["releaseMemoryAnyCursor"]}],
|
||||
})
|
||||
});
|
||||
|
||||
admin.createUser({user: "userCollection", pwd: "pass", roles: ["releaseCollection"]});
|
||||
admin.createUser({user: "userDatabase", pwd: "pass", roles: ["releaseDatabase"]});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -31,7 +31,7 @@ function waitForLog(logId, cursorId) {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function makeParallelShellFunctionString(cursorId, collName, sessionId, txnNumber) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const topologyCache = {};
|
|||
|
||||
function getTopologyConnections(conn) {
|
||||
if (!topologyCache.allConnections) {
|
||||
jsTest.log.debug(`Discovering topology...`)
|
||||
jsTest.log.debug(`Discovering topology...`);
|
||||
topologyCache.allConnections =
|
||||
getAllMongosConnections(conn)
|
||||
.flatMap(connection => DiscoverTopology.findNonConfigNodes(connection, {connectFn}))
|
||||
|
|
@ -40,7 +40,7 @@ function getTopologyConnections(conn) {
|
|||
|
||||
function getAllMongosConnections(conn) {
|
||||
if (!topologyCache.mongosConnectionsArr) {
|
||||
jsTest.log.debug(`Settings the mongos connections array...`)
|
||||
jsTest.log.debug(`Settings the mongos connections array...`);
|
||||
if (isMultiShardedClusterFixture) {
|
||||
const connections =
|
||||
conn.getDB("config").multiShardedClusterFixture.find().sort({_id: 1}).toArray();
|
||||
|
|
@ -48,8 +48,7 @@ function getAllMongosConnections(conn) {
|
|||
// Set the connections array to include both when using a multi-cluster fixture.
|
||||
topologyCache.mongosConnectionsArr =
|
||||
connections.map(doc => connectFn(doc.connectionString));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
topologyCache.mongosConnectionsArr = [conn];
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +100,7 @@ function runCommandOverride(conn, dbName, cmdName, cmdObj, clientFunction, makeF
|
|||
const mongosConnArr = getAllMongosConnections(conn);
|
||||
// In case we run the test using the two-cluster fixture, assert we have exactly two
|
||||
// mongos connections.
|
||||
assert.eq(mongosConnArr.length, 2)
|
||||
assert.eq(mongosConnArr.length, 2);
|
||||
// Mirror the command on the second cluster to ensure the collections exists.
|
||||
// TODO SERVER-100658 Explain on non-existent collection returns empty results for
|
||||
// sharded cluster aggregations - Assess if this is still needed.
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ import {fc} from "jstests/third_party/fast_check/fc-3.1.0.js";
|
|||
// If additional options need to be passed, use `fc.oneof`.
|
||||
export const oneof = function(...arbs) {
|
||||
return fc.oneof({withCrossShrink: true}, ...arbs);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
*/
|
||||
import {AllCommandsTest} from "jstests/libs/all_commands_test.js";
|
||||
import {getCommandName} from "jstests/libs/cmd_object_utils.js"
|
||||
import {getCommandName} from "jstests/libs/cmd_object_utils.js";
|
||||
import {configureFailPoint} from "jstests/libs/fail_point_util.js";
|
||||
import {FeatureFlagUtil} from "jstests/libs/feature_flag_util.js";
|
||||
import {Thread} from "jstests/libs/parallelTester.js";
|
||||
|
|
@ -2704,7 +2704,7 @@ let wcCommandsTests = {
|
|||
assert.commandWorkedIgnoringWriteConcernErrors(res);
|
||||
assert.eq(bsonWoCompare(getShardKey(coll, fullNs), {x: 1}), 0);
|
||||
|
||||
restartfAdditionalSecondariesIfSharded(clusterType, cluster, secondariesRunning);
|
||||
restartAdditionalSecondariesIfSharded(clusterType, cluster, secondariesRunning);
|
||||
},
|
||||
admin: true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
// TODO SERVER-102285: Run this test against a sharded cluster as well.
|
||||
|
||||
const conn = MongoRunner.runMongod({});
|
||||
const dbName = 'getmore_cmd_test'
|
||||
const dbName = 'getmore_cmd_test';
|
||||
const collName = 'getmore_cmd_invalid_namespace';
|
||||
const db = conn.getDB(dbName);
|
||||
const coll = db[collName];
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function setup(conn) {
|
|||
coll.drop();
|
||||
assert.commandWorked(coll.createIndex({a: 1}, {sparse: true, collation: {locale: "en"}}));
|
||||
assert.commandWorked(coll.createIndex({b: 1}, {partialFilterExpression: {b: {$gte: 0}}}));
|
||||
coll.insert({a: 1, b: [1]})
|
||||
coll.insert({a: 1, b: [1]});
|
||||
|
||||
// Setup other collection
|
||||
const otherColl = db[otherCollName];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
|
||||
js_library(
|
||||
name = "all_javascript_files",
|
||||
srcs = glob([
|
||||
"*.js",
|
||||
]),
|
||||
target_compatible_with = select({
|
||||
"//bazel/config:ppc_or_s390x": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
@ -169,7 +169,7 @@ const clusterParameter4 = {
|
|||
const response = st.s.adminCommand({listShards: 1});
|
||||
assert.commandWorked(response);
|
||||
assert.eq(response.shards.length, 2);
|
||||
assert(response.shards.some(shard => shard._id === "hagymasbab"))
|
||||
assert(response.shards.some(shard => shard._id === "hagymasbab"));
|
||||
}
|
||||
|
||||
jsTest.log("Non-first RS is unlocked after write");
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ function testReleaseMemory({func, useSession, cursorsNum, pinCursor, unknownCurs
|
|||
// Manually start a session so it can be continued from inside a parallel shell.
|
||||
const sessionId = assert.commandWorked(mongosDB.adminCommand({startSession: 1})).id;
|
||||
findCmd.lsid = sessionId;
|
||||
sessionIdsArr.push(sessionId)
|
||||
sessionIdsArr.push(sessionId);
|
||||
}
|
||||
|
||||
jsTest.log(`Running find command ${i}`);
|
||||
|
|
@ -86,7 +86,7 @@ function testReleaseMemory({func, useSession, cursorsNum, pinCursor, unknownCurs
|
|||
let cursor = findRes.cursor;
|
||||
assert.neq(cursor.id, NumberLong(0));
|
||||
results.push(cursor.firstBatch);
|
||||
cursorIdsArr.push(cursor.id)
|
||||
cursorIdsArr.push(cursor.id);
|
||||
}
|
||||
|
||||
let shard0DBFailpoint;
|
||||
|
|
@ -122,7 +122,7 @@ function testReleaseMemory({func, useSession, cursorsNum, pinCursor, unknownCurs
|
|||
assert.eq(cmdRes.cursorsAlive, []);
|
||||
assert.eq(cmdRes.cursorsNotFound, []);
|
||||
assert.eq(cmdRes.cursorsUnknown, []);
|
||||
++cursorIdx
|
||||
++cursorIdx;
|
||||
}
|
||||
|
||||
// Use the function provided by the caller to call the releaseMemory command.
|
||||
|
|
|
|||
|
|
@ -78,6 +78,6 @@ jsTest.log(`Running aggregate command`);
|
|||
let aggregateRes = coll.aggregate([{$sort: {_id: 1}}], {cursor: {batchSize: 2}});
|
||||
assertArrayEq({actual: aggregateRes._batch, expected: docs.slice(0, 2)});
|
||||
assert.neq(aggregateRes._cursorid, NumberLong(0));
|
||||
runTest(aggregateRes._cursorid, 2)
|
||||
runTest(aggregateRes._cursorid, 2);
|
||||
|
||||
st.stop();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
} from "jstests/with_mongot/e2e_lib/search_e2e_utils.js";
|
||||
|
||||
const collAName = "search_rank_fusion_collA";
|
||||
const collBName = "search_rank_fusion_collB"
|
||||
const collBName = "search_rank_fusion_collB";
|
||||
const collA = db.getCollection(collAName);
|
||||
const collB = db.getCollection(collBName);
|
||||
collA.drop();
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ const nDocs = 50;
|
|||
let bulk = coll.initializeUnorderedBulkOp();
|
||||
for (let i = 0; i < nDocs; i++) {
|
||||
if (i % 2 === 0) {
|
||||
bulk.insert({_id: i, a: "foo", x: i / 3})
|
||||
bulk.insert({_id: i, a: "foo", x: i / 3});
|
||||
} else {
|
||||
bulk.insert({_id: i, a: "bar", x: i / 3})
|
||||
bulk.insert({_id: i, a: "bar", x: i / 3});
|
||||
}
|
||||
}
|
||||
assert.commandWorked(bulk.execute());
|
||||
|
|
@ -76,7 +76,7 @@ const metaFieldName = "tags";
|
|||
const timeseriesCollName = "rank_fusion_timeseries";
|
||||
|
||||
assert.commandWorked(db.createCollection(
|
||||
timeseriesCollName, {timeseries: {timeField: timeFieldName, metaField: metaFieldName}}))
|
||||
timeseriesCollName, {timeseries: {timeField: timeFieldName, metaField: metaFieldName}}));
|
||||
const tsColl = db.getCollection(timeseriesCollName);
|
||||
|
||||
bulk = tsColl.initializeUnorderedBulkOp();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import {
|
|||
|
||||
// Create multiple collections in order to correctly run an identity $unionWith query.
|
||||
const collAName = "search_rank_fusion_collA";
|
||||
const collBName = "search_rank_fusion_collB"
|
||||
const collBName = "search_rank_fusion_collB";
|
||||
const collA = db.getCollection(collAName);
|
||||
const collB = db.getCollection(collBName);
|
||||
collA.drop();
|
||||
|
|
|
|||
Loading…
Reference in New Issue