mongo/jstests/noPassthrough/version.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

28 lines
743 B
JavaScript

/**
* Test that the --version command always outputs the following format to avoid downstream
* breakages:
*
* sh*| ... version ...
* sh*| Build Info: {
* ...
* sh*| }
*/
const dbVersionMatch = /sh([0-9]{1,10})\| .+ version .+/;
const buildInfoMatch = /sh([0-9]{1,10})\| Build Info: {/;
const testVersionOutput = (exePath) => {
clearRawMongoProgramOutput();
runNonMongoProgram(exePath, "--version");
const out = rawMongoProgramOutput(".*").split("\n");
assert.neq(out[0].match(dbVersionMatch), null);
assert.neq(out[1].match(buildInfoMatch), null);
};
testVersionOutput(MongoRunner.getMongodPath());
testVersionOutput(MongoRunner.getMongosPath());
testVersionOutput(MongoRunner.getMongoShellPath());