Skip to content

test: QoL improvements #2731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions test/functional/client_side_encryption/corpus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ const fs = require('fs');
const path = require('path');
const BSON = require('bson');
const { EJSON } = require('bson');
const chai = require('chai');
const expect = chai.expect;
chai.config.includeStack = true;
chai.config.showDiff = true;
chai.config.truncateThreshold = 0;
const { expect } = require('chai');

describe('Client Side Encryption Corpus', function () {
const metadata = {
Expand Down
3 changes: 0 additions & 3 deletions test/functional/client_side_encryption/driver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ const crypto = require('crypto');
const BSON = require('bson');
const chai = require('chai');
const expect = chai.expect;
chai.config.includeStack = true;
chai.config.showDiff = true;
chai.config.truncateThreshold = 0;
chai.use(require('chai-subset'));

describe('Client Side Encryption Functional', function () {
Expand Down
3 changes: 0 additions & 3 deletions test/functional/spec-runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ function promiseTry(callback) {

chai.use(require('chai-subset'));
chai.use(require('./matcher').default);
chai.config.includeStack = true;
chai.config.showDiff = true;
chai.config.truncateThreshold = 0;

function escape(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/spec-runner/matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function matchMongoSpec(chai, utils) {
'expected #{act} to not match spec #{exp}',
result.expected,
result.actual,
chai.config.showDiff
chai.config.showDiff || true
);
});

Expand Down
19 changes: 14 additions & 5 deletions test/tools/cluster_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

if [ "$#" -ne 1 ]; then
echo "usage: cluster_setup <server|replica_set|sharded_cluster>"
echo "override <DATA_DIR | SINGLE_DIR | REPLICASET_DIR | SHARDED_DIR> env variables to change dbPath"
exit
fi

DATA_DIR=${DATA_DIR:-data}
SINGLE_DIR=${SINGLE_DIR:-$DATA_DIR/server}
REPLICASET_DIR=${REPLICASET_DIR:-$DATA_DIR/replica_set}
SHARDED_DIR=${SHARDED_DIR:-$DATA_DIR/sharded_cluster}

if [[ $1 == "replica_set" ]]; then
mlaunch init --replicaset --nodes 3 --arbiter --name rs --port 31000 --enableMajorityReadConcern --setParameter enableTestCommands=1
echo "mongodb://localhost:31000/?replicaSet=rs"
mkdir -p $REPLICASET_DIR
mlaunch init --dir $REPLICASET_DIR --replicaset --nodes 3 --arbiter --name rs --port 31000 --enableMajorityReadConcern --setParameter enableTestCommands=1
echo "mongodb://localhost:31000,localhost:31001,localhost:31002/?replicaSet=rs"
elif [[ $1 == "sharded_cluster" ]]; then
mlaunch init --replicaset --nodes 3 --arbiter --name rs --port 51000 --enableMajorityReadConcern --setParameter enableTestCommands=1 --sharded 1 --mongos 2
echo "mongodb://localhost:51000,localhost:51001/"
mkdir -p $SHARDED_DIR
mlaunch init --dir $SHARDED_DIR --replicaset --nodes 3 --arbiter --name rs --port 51000 --enableMajorityReadConcern --setParameter enableTestCommands=1 --sharded 1 --mongos 2
echo "mongodb://localhost:51000,localhost:51001"
elif [[ $1 == "server" ]]; then
mlaunch init --single --setParameter enableTestCommands=1
mkdir -p $SINGLE_DIR
mlaunch init --dir $SINGLE_DIR --single --setParameter enableTestCommands=1
echo "mongodb://localhost:27017"
else
echo "unsupported topology: $1"
Expand Down
6 changes: 5 additions & 1 deletion test/tools/reporter/mongodb_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ function replaceIllegalXMLCharacters(string) {
const ANSI_ESCAPE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
function outputToXML(output) {
function cdata(str) {
return `<![CDATA[${str.split(ANSI_ESCAPE_REGEX).join('').split(']]>').join('\\]\\]\\>')}]]>`;
return `<![CDATA[${String(str)
.split(ANSI_ESCAPE_REGEX)
.join('')
.split(']]>')
.join('\\]\\]\\>')}]]>`;
}

function makeTag(name, attributes, selfClose, content) {
Expand Down
2 changes: 0 additions & 2 deletions test/tools/runner/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ const chai = require('chai');
chai.use(require('sinon-chai'));
chai.use(require('chai-subset'));
chai.use(require('../../functional/spec-runner/matcher').default);
chai.config.includeStack = true;
chai.config.showDiff = true;
chai.config.truncateThreshold = 0;

// install signal handlers for printing open/active handles
Expand Down