-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
report: add
--report-disable-network
option
New option `--report-disable-network`, also available as `report.disableNetwork`, enables the user to disable networking interfaces in their diagnostic report. On some systems, this can cause the report to take minutes to generate so this option can be used to optimize that. fixes: #46060
- Loading branch information
1 parent
68885d5
commit 1f12672
Showing
8 changed files
with
123 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('node:assert'); | ||
const { spawnSync } = require('node:child_process'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { describe, it, before } = require('node:test'); | ||
const fs = require('node:fs'); | ||
const helper = require('../common/report'); | ||
|
||
function validate(pid) { | ||
const reports = helper.findReports(pid, tmpdir.path); | ||
assert.strictEqual(reports.length, 1); | ||
let report = fs.readFileSync(reports[0], { encoding: 'utf8' }); | ||
report = JSON.parse(report); | ||
assert.strictEqual(report.header.networkInterfaces, undefined); | ||
fs.unlinkSync(reports[0]); | ||
} | ||
|
||
describe('report disable network option', () => { | ||
before(() => { | ||
tmpdir.refresh(); | ||
process.report.directory = tmpdir.path; | ||
}); | ||
|
||
it('should be configurable with --report-disable-network', () => { | ||
const args = ['--report-disable-network', '-e', 'process.report.writeReport()']; | ||
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | ||
assert.strictEqual(child.status, 0); | ||
assert.strictEqual(child.signal, null); | ||
validate(child.pid); | ||
}); | ||
|
||
it('should be configurable with report.disableNetwork', () => { | ||
process.report.disableNetwork = true; | ||
process.report.writeReport(); | ||
validate(process.pid); | ||
}); | ||
}); |