perf: bound runtime memory and storage usage

This commit is contained in:
whyour
2026-08-16 16:29:06 +08:00
parent 31f78e4d1f
commit 276dfc2382
30 changed files with 1350 additions and 68 deletions
+28
View File
@@ -0,0 +1,28 @@
const assert = require('node:assert/strict');
const test = require('node:test');
const configPath = require.resolve('../../ecosystem.config');
function loadConfig(containerValue) {
if (containerValue === undefined) {
delete process.env.QL_CONTAINER;
} else {
process.env.QL_CONTAINER = containerValue;
}
delete require.cache[configPath];
return require(configPath).apps[0];
}
test('container logging goes to the container standard streams', () => {
const app = loadConfig('true');
assert.equal(app.out_file, '/proc/1/fd/1');
assert.equal(app.error_file, '/proc/1/fd/2');
assert.equal(app.time, false);
});
test('non-container installs keep the PM2 logging defaults', () => {
const app = loadConfig(undefined);
assert.equal(app.out_file, undefined);
assert.equal(app.error_file, undefined);
assert.equal(app.time, true);
});