summaryrefslogtreecommitdiff
path: root/jstests/core/jsHeapLimit.js
blob: 51d9cdc7b7e6c023599e9b164fa12a9a3c94bb32 (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
(function() {
    "use strict";

    const options = {setParameter: "jsHeapLimitMB=1000"};
    const conn = MongoRunner.runMongod(options);

    // verify JSHeapLimitMB set from the shell
    var assertLimit = function() {
        assert.eq(999, getJSHeapLimitMB());
    };
    var exitCode = runMongoProgram("mongo",
                                   conn.host,
                                   "--jsHeapLimitMB",
                                   999,
                                   "--eval",
                                   "(" + assertLimit.toString() + ")();");
    assert.eq(0, exitCode);

    // verify the JSHeapLimitMB set from Mongod
    const db = conn.getDB('test');
    const res = db.adminCommand({getParameter: 1, jsHeapLimitMB: 1});
    assert.commandWorked(res);
    assert.eq(1000, res.jsHeapLimitMB);

    MongoRunner.stopMongod(conn);
})();