Skip to content

Commit

Permalink
feat(Update): add the ability to specify a pipeline to an update comm…
Browse files Browse the repository at this point in the history
…and (mongodb#2017)

* feat(Update): add the ability to specify a pipeline to an update command

NODE-1920
  • Loading branch information
Sam Pal authored and Rosemary Yin committed Aug 19, 2019
1 parent 3dd7d2b commit f13c965
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
7 changes: 7 additions & 0 deletions test-runner-poc/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
'use strict';
<<<<<<< HEAD
=======
const f = require('util').format;
>>>>>>> feat(Update): add the ability to specify a pipeline to an update command (#2017)
const url = require('url');
const qs = require('querystring');
const core = require('../lib/core');
Expand All @@ -16,9 +20,12 @@ class NativeConfiguration {
};
this.topology = environment.topology || this.defaultTopology;
this.environment = environment;
<<<<<<< HEAD
if (environment.setName) {
this.replicasetName = environment.setName || 'rs';
}
=======
>>>>>>> feat(Update): add the ability to specify a pipeline to an update command (#2017)
}
usingUnifiedTopology() {
return !!process.env.MONGODB_UNIFIED_TOPOLOGY;
Expand Down
30 changes: 19 additions & 11 deletions test-runner-poc/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class EnvironmentBase {
setup(callback) {
callback();
}
constructor(parsedURI) {
this.host = parsedURI.hosts[0].host;
this.port = parsedURI.hosts[0].port;
constructor(status) {
if (status.primary) {
this.port = parseInt(status.primary.split(':')[1]);
this.host = status.primary.split(':')[0];
}
}
}
const genReplsetConfig = (port, options) => {
Expand Down Expand Up @@ -55,13 +57,7 @@ class ReplicaSetEnvironment extends EnvironmentBase {
}
return new core.ReplSet([{ topologyHost, topologyPort }], options);
};
this.nodes = [
genReplsetConfig(this.port, { tags: { loc: 'ny' } }),
genReplsetConfig(this.port + 1, { tags: { loc: 'sf' } }),
genReplsetConfig(this.port + 2, { tags: { loc: 'sf' } }),
genReplsetConfig(this.port + 3, { tags: { loc: 'sf' } }),
genReplsetConfig(this.port + 4, { arbiter: true })
];

// Do we have 3.2+
if (semver.satisfies(version, '>=3.2.0')) {
this.nodes = this.nodes.map(function(x) {
Expand All @@ -71,6 +67,15 @@ class ReplicaSetEnvironment extends EnvironmentBase {
}
}
}

function generateNodesArray(hosts, configFunc){
let nodesArray = [];
for (let i = 0; i < hosts.length; i++) {
nodesArray[i] = configFunc(hosts[i].port || hosts[0].port + i);
}
return nodesArray;
}

/**
*
*/
Expand Down Expand Up @@ -130,8 +135,11 @@ class ShardedEnvironment extends EnvironmentBase {
}
setup(callback) {
const shardOptions = this.options && this.options.shard ? this.options.shard : {};
// First set of nodes
//const nodes1 = generateNodesArray(parsedURI.hosts, genShardedConfig);

const configOptions = this.options && this.options.config ? this.options.config : {};
const configNodes = [genConfigNode(35000, configOptions)];
//const configNodes = [genConfigNode(35000, configOptions)];
let proxyNodes = [
{
bind_ip: 'localhost',
Expand Down

0 comments on commit f13c965

Please sign in to comment.