summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/pid_testing_log.js
blob: 91ff3d7612e778461263b275f2097afc29355276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
load("jstests/libs/parallelTester.js");

/**
 * @tags: [requires_replication, requires_sharding]
 *
 * Test that servers set up in testing mode print the
 * pid when they connect as a client to a mongod.
 *
 */

(function() {
"use strict";

const rsMin = 10;
const rsMax = 20;

const baselineParameters = {
    ShardingTaskExecutorPoolMinSize: rsMin,
    ShardingTaskExecutorPoolMaxSize: rsMax,
    ShardingTaskExecutorPoolMinSizeForConfigServers: 4,
    ShardingTaskExecutorPoolMaxSizeForConfigServers: 6,
};

const mongosParameters = Object.assign(
    {logComponentVerbosity: tojson({network: {connectionPool: 5}})}, baselineParameters);

const st = new ShardingTest({
    config: {nodes: 1},
    shards: 1,
    rs0: {nodes: 1},
    mongos: [{setParameter: mongosParameters}],
});
const mongos = st.s0;

const populateTestDb = () => {
    const db = mongos.getDB('test');
    const coll = db.test;
    assert.commandWorked(coll.insert({x: 1}));
};

populateTestDb();

let log = checkLog.getGlobalLog(mongos);
let hits = log.map(line => JSON.parse(line))
               .filter(o => o.msg == "client metadata")
               .filter(o => o.attr.doc.application.pid !== null);

assert(hits.length > 0);

st.stop();
})();