MCPcopy
hub / github.com/mongodb/node-mongodb-native / setup

Method setup

test/tools/spec-runner/context.js:76–101  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

74 }
75
76 setup(config) {
77 const options = {};
78 if (this.requiresCSFLE) {
79 options.promoteValues = false;
80 options.promoteLongs = false;
81 }
82 this.sharedClient = config.newClient(
83 resolveConnectionString(config, { useMultipleMongoses: true }, this),
84 options
85 );
86 if (config.topologyType === 'Sharded') {
87 this.failPointClients = config.options.hostAddresses.map(proxy => {
88 const authString =
89 process.env.AUTH === 'auth'
90 ? `${extractAuthFromConnectionString(process.env.MONGODB_URI)}@`
91 : '';
92 return config.newClient(
93 `mongodb://${authString}${proxy.host}:${proxy.port}/${
94 process.env.AUTH === 'auth' ? '?authSource=admin' : ''
95 }`
96 );
97 });
98 }
99
100 return this.runForAllClients(client => client.connect());
101 }
102
103 async teardown() {
104 await this.runForAllClients(client => client.close());

Callers

nothing calls this directly

Calls 6

runForAllClientsMethod · 0.95
resolveConnectionStringFunction · 0.85
newClientMethod · 0.45
mapMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected