Commit 4cd611f6 authored by Xavier Guimard's avatar Xavier Guimard

New upstream version 3.1.8+~3.0.2+~3.1.7+~1.0.1

parent bfdb2ae8
# When a task that used to pass starts to fail
# Go through all versions that may have been skipped to detect
# when the task started failing
stepback: true
# Mark a failure as a system/bootstrap failure (purple box) rather then a task
# failure by default.
# Actual testing tasks are marked with `type: test`
command_type: system
# Protect ourself against rogue test case, or curl gone wild, that runs forever
# Good rule of thumb: the averageish length a task takes, times 5
# That roughly accounts for variable system performance for various buildvariants
exec_timeout_secs: 1800 # 6 minutes is the longest we'll ever run
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
- command: shell.exec
params:
script: |
ls -la
functions:
"fetch source":
# Executes git clone and applies the submitted patch, if any
- command: git.get_project
params:
directory: "src"
# Applies the submitted patch, if any
# Deprecated. Should be removed. But still needed for certain agents (ZAP)
- command: git.apply_patch
# Make an evergreen exapanstion file with dynamic values
- command: shell.exec
params:
working_dir: "src"
script: |
# Get the current unique version of this checkout
if [ "${is_patch}" = "true" ]; then
CURRENT_VERSION=$(git describe)-patch-${version_id}
else
CURRENT_VERSION=latest
fi
export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
export PROJECT_DIRECTORY="$(pwd)"
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
export UPLOAD_BUCKET="${project}"
cat <<EOT > expansion.yml
CURRENT_VERSION: "$CURRENT_VERSION"
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES: "$MONGODB_BINARIES"
UPLOAD_BUCKET: "$UPLOAD_BUCKET"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
PREPARE_SHELL: |
set -o errexit
set -o xtrace
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
export MONGODB_BINARIES="$MONGODB_BINARIES"
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
export PATH="$MONGODB_BINARIES:$PATH"
export PROJECT="${project}"
EOT
# See what we've done
cat expansion.yml
# Load the expansion file to make an evergreen variable with the current unique version
- command: expansions.update
params:
file: src/expansion.yml
"prepare resources":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf $DRIVERS_TOOLS
git clone git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
"run tests":
- command: shell.exec
type: test
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} AUTH=${AUTH} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
"cleanup":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
rm -rf $DRIVERS_TOOLS || true
"fix absolute paths":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do
perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename
done
# "windows fix":
# - command: shell.exec
# params:
# script: |
# ${PREPARE_SHELL}
# for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
# cat $i | tr -d '\r' > $i.new
# mv $i.new $i
# done
# # Copy client certificate because symlinks do not work on Windows.
# cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
"make files executable":
- command: shell.exec
params:
script: |
${PREPARE_SHELL}
for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do
chmod +x $i
done
"install dependencies":
- command: shell.exec
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
NODE_LTS_NAME=${NODE_LTS_NAME} sh ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
"run atlas tests":
- command: shell.exec
params:
working_dir: "src"
silent: true
script: |
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}' ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' sh ${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh
pre:
- func: "fetch source"
- func: "prepare resources"
# - func: "windows fix"
- func: "fix absolute paths"
- func: "make files executable"
- func: "install dependencies"
post:
- func: "cleanup"
This diff is collapsed.
'use strict';
const semver = require('semver');
const fs = require('fs');
const yaml = require('js-yaml');
const MONGODB_VERSIONS = ['latest', '4.0', '3.6', '3.4', '3.2', '3.0', '2.6'];
const NODE_VERSIONS = ['carbon', 'boron', 'argon'];
const TOPOLOGIES = ['server', 'replica_set', 'sharded_cluster'];
const OPERATING_SYSTEMS = [
{
name: 'linux-64-amzn-test',
display_name: 'Amazon Linux (Enterprise)',
run_on: 'linux-64-amzn-test'
},
{
name: 'ubuntu-14.04',
display_name: 'Ubuntu 14.04',
run_on: 'ubuntu1404-test'
},
{
name: 'rhel70',
display_name: 'RHEL 7.0',
run_on: 'rhel70-small'
},
{
name: 'debian71-test',
display_name: 'Debian 7.1',
run_on: 'debian71-test'
},
// OSes that support versions of MongoDB without SSL.
{
name: 'archlinux-test',
display_name: 'Archlinux',
run_on: 'archlinux-test',
auth: false
},
{
name: 'macos-1012',
display_name: 'macOS 10.12',
run_on: 'macos-1012',
auth: false
},
// >= 3.2
{
name: 'ubuntu-16.04',
display_name: 'Ubuntu 16.04',
run_on: 'ubuntu1604-test',
mongoVersion: '>=3.2'
},
{
name: 'suse12-x86-64-test',
display_name: 'SUSE 12 (x86_64)',
run_on: 'suse12-test',
mongoVersion: '>=3.2'
},
{
name: 'rhel71-power8-test',
display_name: 'RHEL 7.1 (POWER8)',
run_on: 'rhel71-power8-test',
mongoVersion: '>=3.2'
},
// >= 3.4
{
name: 'debian81-test',
display_name: 'Debian 8.1',
run_on: 'debian81-test',
mongoVersion: '>=3.4',
nodeVersion: 'boron'
},
// reenable when these are actually running 7.2, or we release a 7.4 rpm
// {
// name: 'rhel72-zseries-test',
// display_name: 'RHEL 7.2 (zSeries)',
// run_on: 'rhel72-zseries-test',
// mongoVersion: '>=3.4',
// nodeVersion: 'boron'
// },
{
name: 'suse12-zseries-test',
display_name: 'SUSE 12 (zSeries)',
run_on: 'suse12-zseries-test',
mongoVersion: '>=3.4',
nodeVersion: 'boron'
},
{
name: 'ubuntu1604-arm64-small',
display_name: 'Ubuntu 16.04 (ARM64)',
run_on: 'ubuntu1604-arm64-small',
mongoVersion: '>=3.4',
nodeVersion: 'boron'
},
{
name: 'ubuntu1604-power8-test',
display_name: 'Ubuntu 16.04 (POWER8)',
run_on: 'ubuntu1604-power8-test',
mongoVersion: '>=3.4',
nodeVersion: 'boron'
},
{
name: 'ubuntu1604-zseries-small',
display_name: 'Ubuntu 16.04 (zSeries)',
run_on: 'ubuntu1604-zseries-small',
mongoVersion: '>=3.4',
nodeVersion: 'boron'
},
// Windows. reenable this when nvm supports windows, or we settle on an alternative tool
// {
// name: 'windows-64-vs2010-test',
// display_name: 'Windows (VS2010)',
// run_on: 'windows-64-vs2010-test'
// },
// {
// name: 'windows-64-vs2013-test',
// display_name: 'Windows (VS2013)',
// run_on: 'windows-64-vs2013-test'
// },
// {
// name: 'windows-64-vs2015-test',
// display_name: 'Windows (VS2015)',
// run_on: 'windows-64-vs2015-test'
// }
].map(osConfig => Object.assign({
mongoVersion: '>=2.6',
nodeVersion: 'argon',
auth: false
}, osConfig)
);
const TASKS = [];
function makeTask({ mongoVersion, topology }) {
return {
name: `test-${mongoVersion}-${topology}`,
tags: [mongoVersion, topology],
commands: [
{
func: 'run tests',
vars: {
VERSION: mongoVersion,
TOPOLOGY: topology
}
}
]
};
}
MONGODB_VERSIONS.forEach(mongoVersion => {
TOPOLOGIES.forEach(topology => {
TASKS.push(makeTask({ mongoVersion, topology }));
});
});
const BUILD_VARIANTS = [];
const getTaskList = (() => {
const memo = {};
return function(mongoVersion) {
const key = mongoVersion;
if (memo[key]) {
return memo[key];
}
const ret = TASKS.filter(task => {
const { VERSION } = task.commands[0].vars;
if (VERSION === 'latest') {
return true;
}
return semver.satisfies(semver.coerce(VERSION), mongoVersion);
}).map(x => x.name);
memo[key] = ret;
return ret;
}
})();
OPERATING_SYSTEMS.forEach(
({ name: osName, display_name: osDisplayName, run_on, mongoVersion = '>=2.6', nodeVersion = 'argon' }) => {
const nodeVersions = NODE_VERSIONS.filter(nv => nv >= nodeVersion);
const tasks = getTaskList(mongoVersion);
nodeVersions.forEach(NODE_LTS_NAME => {
const nodeLtsDisplayName = `Node ${NODE_LTS_NAME[0].toUpperCase()}${NODE_LTS_NAME.substr(1)}`;
const name = `${osName}-${NODE_LTS_NAME}`;
const display_name = `${osDisplayName} ${nodeLtsDisplayName}`;
const expansions = { NODE_LTS_NAME };
BUILD_VARIANTS.push({ name, display_name, run_on, expansions, tasks });
});
}
);
const fileData = yaml.safeLoad(fs.readFileSync(`${__dirname}/_config.template.yml`, 'utf8'))
fileData.tasks = (fileData.tasks || []).concat(TASKS);
fileData.buildvariants = (fileData.buildvariants || []).concat(BUILD_VARIANTS);
fs.writeFileSync(`${__dirname}/config.yml`, yaml.safeDump(fileData), 'utf8');
#!/bin/sh
# set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail
NODE_LTS_NAME=${NODE_LTS_NAME:-carbon}
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
NPM_CACHE_DIR="${NODE_ARTIFACTS_PATH}/npm"
NPM_TMP_DIR="${NODE_ARTIFATS_PATH}/tmp"
# this needs to be explicitly exported for the nvm install below
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
# create node artifacts path if needed
mkdir -p ${NODE_ARTIFACTS_PATH}
mkdir -p ${NPM_CACHE_DIR}
mkdir -p "${NPM_TMP_DIR}"
# install Node.js
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
[ -s "${NVM_DIR}/nvm.sh" ] && \. "${NVM_DIR}/nvm.sh"
nvm install --lts=${NODE_LTS_NAME}
# setup npm cache in a local directory
cat <<EOT > .npmrc
devdir=${NPM_CACHE_DIR}/.node-gyp
init-module=${NPM_CACHE_DIR}/.npm-init.js
cache=${NPM_CACHE_DIR}
tmp=${NPM_TMP_DIR}
EOT
# install node dependencies
npm install
#!/bin/sh
# set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail
# Supported/used environment variables:
# AUTH Set to enable authentication. Defaults to "noauth"
# SSL Set to enable SSL. Defaults to "nossl"
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
# MARCH Machine Architecture. Defaults to lowercase uname -m
AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
MONGODB_URI=${MONGODB_URI:-}
DRIVERS_TOOLS=${DRIVERS_TOOLS:-}
MONGODB_VERSION=${MONGODB_VERSION:-}
# install MongoDB
# Functions to fetch MongoDB binaries
. ${DRIVERS_TOOLS}/.evergreen/download-mongodb.sh
get_distro
if [ -z "$MONGODB_DOWNLOAD_URL" ]; then
get_mongodb_download_url_for "$DISTRO" "$MONGODB_VERSION"
fi
# Even though we have the MONGODB_DOWNLOAD_URL, we still call this to get the proper EXTRACT variable
get_mongodb_download_url_for "$DISTRO"
download_and_extract "$MONGODB_DOWNLOAD_URL" "$EXTRACT"
# run tests
echo "Running $AUTH tests over $SSL, connecting to $MONGODB_URI"
export PATH="/opt/mongodbtoolchain/v2/bin:$PATH"
NODE_ARTIFACTS_PATH="${PROJECT_DIRECTORY}/node-artifacts"
export NVM_DIR="${NODE_ARTIFACTS_PATH}/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
MONGODB_VERSION=${MONGODB_VERSION} MONGODB_ENVIRONMENT=${TOPOLOGY} npm test -- --local
This diff is collapsed.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age,
body size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual
identity and orientation.
Please also take a moment to review [MongoDB's core values][mdb-core-values].
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an
appointed representative at an online or offline event. Representation of a
project may be further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team, or by
[contacting GitHub][github-report-abuse]. All complaints will be reviewed
and investigated and will result in a response that is deemed necessary and
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version [1.4][version].
[github-report-abuse]: https://github.com/contact/report-abuse
[homepage]: https://www.contributor-covenant.org/
[mdb-core-values]: https://www.mongodb.com/company/
[version]: https://www.contributor-covenant.org/version/1/4/
# Contributing
When contributing to this repository, please first discuss the change you wish
to make via issue, pull request, or any other method with the owners of this
repository before making a change.
Please note we have a [code of conduct][code-of-conduct],
please follow it in all your interactions with the project.
## Commit messages
Please follow the [Angular commit style][angular-commit-style].
This helps the team automate [HISTORY.md](HISTORY.md) generation.
## Pull Request Process
1. Update the README.md or similar documentation with details of changes you
wish to make, if applicable.
2. Add any appropriate tests.
3. Make your code or other changes.
4. Review guidelines such as
[How to write the perfect pull request][github-perfect-pr], thanks!
[angular-commit-style]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits
[changelog]: CHANGELOG.md
[code-of-conduct]: CODE_OF_CONDUCT.md
[github-perfect-pr]: https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/
[mdb-core-values]: https://www.mongodb.com/company/
...@@ -2,6 +2,57 @@ ...@@ -2,6 +2,57 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="3.1.8"></a>
## [3.1.8](https://github.com/mongodb/node-mongodb-native/compare/v3.1.7...v3.1.8) (2018-10-10)
### Bug Fixes
* **connect:** use reported default databse from new uri parser ([811f8f8](https://github.com/mongodb/node-mongodb-native/commit/811f8f8))
### Features
* **core:** update to mongodb-core v3.1.7 ([dbfc905](https://github.com/mongodb/node-mongodb-native/commit/dbfc905))
<a name="3.1.7"></a>
## [3.1.7](https://github.com/mongodb/node-mongodb-native/compare/v3.1.6...v3.1.7) (2018-10-09)
### Features
* **core:** update mongodb-core to v3.1.6 ([61b054e](https://github.com/mongodb/node-mongodb-native/commit/61b054e))
<a name="3.1.6"></a>
## [3.1.6](https://github.com/mongodb/node-mongodb-native/compare/v3.1.5...v3.1.6) (2018-09-15)
### Features
* **core:** update to core v3.1.5 ([c5f823d](https://github.com/mongodb/node-mongodb-native/commit/c5f823d))
<a name="3.1.5"></a>
## [3.1.5](https://github.com/mongodb/node-mongodb-native/compare/v3.1.4...v3.1.5) (2018-09-14)
### Bug Fixes
* **cursor:** allow `$meta` based sort when passing an array to `sort()` ([f93a8c3](https://github.com/mongodb/node-mongodb-native/commit/f93a8c3))
* **utils:** only set retryWrites to true for valid operations ([3b725ef](https://github.com/mongodb/node-mongodb-native/commit/3b725ef))
### Features
* **core:** bump core to v3.1.4 ([805d58a](https://github.com/mongodb/node-mongodb-native/commit/805d58a))
<a name="3.1.4"></a> <a name="3.1.4"></a>
## [3.1.4](https://github.com/mongodb/node-mongodb-native/compare/v3.1.3...v3.1.4) (2018-08-25) ## [3.1.4](https://github.com/mongodb/node-mongodb-native/compare/v3.1.3...v3.1.4) (2018-08-25)
...@@ -39,7 +90,7 @@ All notable changes to this project will be documented in this file. See [standa ...@@ -39,7 +90,7 @@ All notable changes to this project will be documented in this file. See [standa
### Bug Fixes ### Bug Fixes
* **aggregte:** support user-provided `batchSize` ([ad10dee](https://github.com/mongodb/node-mongodb-native/commit/ad10dee)) * **aggregate:** support user-provided `batchSize` ([ad10dee](https://github.com/mongodb/node-mongodb-native/commit/ad10dee))
* **buffer:** replace deprecated Buffer constructor ([759dd85](https://github.com/mongodb/node-mongodb-native/commit/759dd85)) * **buffer:** replace deprecated Buffer constructor ([759dd85](https://github.com/mongodb/node-mongodb-native/commit/759dd85))
* **bulk:** fixing retryable writes for mass-change ops ([0604036](https://github.com/mongodb/node-mongodb-native/commit/0604036)) * **bulk:** fixing retryable writes for mass-change ops ([0604036](https://github.com/mongodb/node-mongodb-native/commit/0604036))
* **bulk:** handle MongoWriteConcernErrors ([12ff392](https://github.com/mongodb/node-mongodb-native/commit/12ff392)) * **bulk:** handle MongoWriteConcernErrors ([12ff392](https://github.com/mongodb/node-mongodb-native/commit/12ff392))
...@@ -110,7 +161,7 @@ All notable changes to this project will be documented in this file. See [standa ...@@ -110,7 +161,7 @@ All notable changes to this project will be documented in this file. See [standa
### Bug Fixes ### Bug Fixes
* **aggregte:** support user-provided `batchSize` ([ad10dee](https://github.com/mongodb/node-mongodb-native/commit/ad10dee)) * **aggregate:** support user-provided `batchSize` ([ad10dee](https://github.com/mongodb/node-mongodb-native/commit/ad10dee))
* **bulk:** fixing retryable writes for mass-change ops ([0604036](https://github.com/mongodb/node-mongodb-native/commit/0604036)) * **bulk:** fixing retryable writes for mass-change ops ([0604036](https://github.com/mongodb/node-mongodb-native/commit/0604036))
* **bulk:** handle MongoWriteConcernErrors ([12ff392](https://github.com/mongodb/node-mongodb-native/commit/12ff392)) * **bulk:** handle MongoWriteConcernErrors ([12ff392](https://github.com/mongodb/node-mongodb-native/commit/12ff392))
* **change_stream:** do not check isGetMore if error[mongoErrorContextSymbol] is undefined ([#1720](https://github.com/mongodb/node-mongodb-native/issues/1720)) ([844c2c8](https://github.com/mongodb/node-mongodb-native/commit/844c2c8)) * **change_stream:** do not check isGetMore if error[mongoErrorContextSymbol] is undefined ([#1720](https://github.com/mongodb/node-mongodb-native/issues/1720)) ([844c2c8](https://github.com/mongodb/node-mongodb-native/commit/844c2c8))
......
NODE = node
NPM = npm
JSDOC = jsdoc
name = all
generate_docs:
# cp -R ./HISTORY.md ./docs/content/meta/release-notes.md
hugo -s docs/reference -d ../../public
$(JSDOC) -c conf.json -t docs/jsdoc-template/ -d ./public/api
cp -R ./public/api/scripts ./public/.
cp -R ./public/api/styles ./public/.
Mongodb-core uses third-party libraries or other resources that may
be distributed under licenses different than the Mongodb-core software.
In the event that we accidentally failed to list a required notice,
please bring it to our attention through any of the ways detailed here:
mongodb-dev@googlegroups.com
The attached notices are provided for information only.
For any licenses that require disclosure of source, sources are available at
https://github.com/mongodb/node-mongodb-native.
1) License Notice for nan.h
---------------------------
The MIT License (MIT)
=====================
Copyright (c) 2016 NAN contributors
-----------------------------------
NAN contributors listed at <https://github.com/nodejs/nan#contributors>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to
do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
var ReplSetManager = require('mongodb-topology-manager').ReplSet,
f = require('util').format;
var rsOptions = {
server: {
keyFile: __dirname + '/test/functional/data/keyfile.txt',
auth: null,
replSet: 'rs'
},
client: {
replSet: 'rs'
}
}
// Set up the nodes
var nodes = [{
options: {
bind_ip: 'localhost', port: 31000,
dbpath: f('%s/../db/31000', __dirname),
}
}, {
options: {
bind_ip: 'localhost', port: 31001,
dbpath: f('%s/../db/31001', __dirname),
}
}, {
options: {
bind_ip: 'localhost', port: 31002,
dbpath: f('%s/../db/31002', __dirname),
}
}]
// Merge in any node start up options
for(var i = 0; i < nodes.length; i++) {
for(var name in rsOptions.server) {
nodes[i].options[name] = rsOptions.server[name];
}
}
// Create a manager
var replicasetManager = new ReplSetManager('mongod', nodes, rsOptions.client);
// Purge the set
replicasetManager.purge().then(function() {
// Start the server
replicasetManager.start().then(function() {
process.exit(0);
}).catch(function(e) {
console.log("====== ")
console.dir(e)
// // console.dir(e);