1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #3793 from Steve-Mcl/sys-info-amendments

Sys info (diagnostics report) amendments
This commit is contained in:
Nick O'Leary 2022-07-21 11:39:50 +01:00 committed by GitHub
commit 51d8792f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 4 deletions

View File

@ -100,9 +100,13 @@ function buildDiagnosticReport(scope, callback) {
version: os.version(), version: os.version(),
}, },
runtime: { runtime: {
isStarted: runtime.isStarted(),
modules: modules,
version: runtime.settings.version, version: runtime.settings.version,
isStarted: runtime.isStarted(),
flows: {
state: runtime.flows && runtime.flows.state(),
started: runtime.flows && runtime.flows.started,
},
modules: modules,
settings: { settings: {
available: runtime.settings.available(), available: runtime.settings.available(),
apiMaxLength: runtime.settings.apiMaxLength || "UNSET", apiMaxLength: runtime.settings.apiMaxLength || "UNSET",
@ -114,6 +118,11 @@ function buildDiagnosticReport(scope, callback) {
flowFile: runtime.settings.flowFile || "UNSET", flowFile: runtime.settings.flowFile || "UNSET",
mqttReconnectTime: runtime.settings.mqttReconnectTime || "UNSET", mqttReconnectTime: runtime.settings.mqttReconnectTime || "UNSET",
serialReconnectTime: runtime.settings.serialReconnectTime || "UNSET", serialReconnectTime: runtime.settings.serialReconnectTime || "UNSET",
socketReconnectTime: runtime.settings.socketReconnectTime || "UNSET",
socketTimeout: runtime.settings.socketTimeout || "UNSET",
tcpMsgQueueSize: runtime.settings.tcpMsgQueueSize || "UNSET",
inboundWebSocketTimeout: runtime.settings.inboundWebSocketTimeout || "UNSET",
runtimeState: runtime.settings.runtimeState || "UNSET",
adminAuth: runtime.settings.adminAuth ? "SET" : "UNSET", adminAuth: runtime.settings.adminAuth ? "SET" : "UNSET",
@ -131,6 +140,7 @@ function buildDiagnosticReport(scope, callback) {
uiHost: runtime.settings.uiHost ? "SET" : "UNSET", uiHost: runtime.settings.uiHost ? "SET" : "UNSET",
uiPort: runtime.settings.uiPort ? "SET" : "UNSET", uiPort: runtime.settings.uiPort ? "SET" : "UNSET",
userDir: runtime.settings.userDir ? "SET" : "UNSET", userDir: runtime.settings.userDir ? "SET" : "UNSET",
nodesDir: runtime.settings.nodesDir && runtime.settings.nodesDir.length ? "SET" : "UNSET",
} }
} }
} }

View File

@ -33,6 +33,11 @@ describe("runtime-api/diagnostics", function() {
flowFile: "flows.json", flowFile: "flows.json",
mqttReconnectTime: 321, mqttReconnectTime: 321,
serialReconnectTime: 432, serialReconnectTime: 432,
socketReconnectTime: 2222,
socketTimeout: 3333,
tcpMsgQueueSize: 4444,
inboundWebSocketTimeout: 5555,
runtimeState: {enabled: true, ui: false},
adminAuth: {},//should be sanitised to "SET" adminAuth: {},//should be sanitised to "SET"
httpAdminRoot: "/admin/root/", httpAdminRoot: "/admin/root/",
httpAdminCors: {},//should be sanitised to "SET" httpAdminCors: {},//should be sanitised to "SET"
@ -45,6 +50,7 @@ describe("runtime-api/diagnostics", function() {
uiHost: "something.secret.com",//should be sanitised to "SET" uiHost: "something.secret.com",//should be sanitised to "SET"
uiPort: 1337,//should be sanitised to "SET" uiPort: 1337,//should be sanitised to "SET"
userDir: "/var/super/secret/",//should be sanitised to "SET", userDir: "/var/super/secret/",//should be sanitised to "SET",
nodesDir: "/var/super/secret/",//should be sanitised to "SET",
contextStorage: { contextStorage: {
default : { module: "memory" }, default : { module: "memory" },
file: { module: "localfilesystem" }, file: { module: "localfilesystem" },
@ -73,8 +79,9 @@ describe("runtime-api/diagnostics", function() {
//result.runtime.xxxxx //result.runtime.xxxxx
const runtimeCount = Object.keys(result.runtime).length; const runtimeCount = Object.keys(result.runtime).length;
runtimeCount.should.eql(4);//ensure no more than 4 keys are present in runtime runtimeCount.should.eql(5);//ensure 5 keys are present in runtime
result.runtime.should.have.property('isStarted',true) result.runtime.should.have.property('isStarted',true)
result.runtime.should.have.property('flows')
result.runtime.should.have.property('modules').type("object"); result.runtime.should.have.property('modules').type("object");
result.runtime.should.have.property('settings').type("object"); result.runtime.should.have.property('settings').type("object");
result.runtime.should.have.property('version','7.7.7'); result.runtime.should.have.property('version','7.7.7');
@ -87,7 +94,7 @@ describe("runtime-api/diagnostics", function() {
//result.runtime.settings.xxxxx //result.runtime.settings.xxxxx
const settingsCount = Object.keys(result.runtime.settings).length; const settingsCount = Object.keys(result.runtime.settings).length;
settingsCount.should.eql(21);//ensure no more than the 21 settings listed below are present in the settings object settingsCount.should.eql(27);//ensure no more than the 21 settings listed below are present in the settings object
result.runtime.settings.should.have.property('available',true); result.runtime.settings.should.have.property('available',true);
result.runtime.settings.should.have.property('apiMaxLength', "UNSET");//deliberately disabled to ensure UNSET is returned result.runtime.settings.should.have.property('apiMaxLength', "UNSET");//deliberately disabled to ensure UNSET is returned
result.runtime.settings.should.have.property('debugMaxLength', 1111); result.runtime.settings.should.have.property('debugMaxLength', 1111);
@ -96,6 +103,11 @@ describe("runtime-api/diagnostics", function() {
result.runtime.settings.should.have.property('flowFile', "flows.json"); result.runtime.settings.should.have.property('flowFile', "flows.json");
result.runtime.settings.should.have.property('mqttReconnectTime', 321); result.runtime.settings.should.have.property('mqttReconnectTime', 321);
result.runtime.settings.should.have.property('serialReconnectTime', 432); result.runtime.settings.should.have.property('serialReconnectTime', 432);
result.runtime.settings.should.have.property('socketReconnectTime', 2222);
result.runtime.settings.should.have.property('socketTimeout', 3333);
result.runtime.settings.should.have.property('tcpMsgQueueSize', 4444);
result.runtime.settings.should.have.property('inboundWebSocketTimeout', 5555);
result.runtime.settings.should.have.property('runtimeState', {enabled: true, ui: false});
result.runtime.settings.should.have.property("adminAuth", "SET"); //should be sanitised to "SET" result.runtime.settings.should.have.property("adminAuth", "SET"); //should be sanitised to "SET"
result.runtime.settings.should.have.property("httpAdminCors", "SET"); //should be sanitised to "SET" result.runtime.settings.should.have.property("httpAdminCors", "SET"); //should be sanitised to "SET"
result.runtime.settings.should.have.property('httpAdminRoot', "/admin/root/"); result.runtime.settings.should.have.property('httpAdminRoot', "/admin/root/");
@ -109,6 +121,7 @@ describe("runtime-api/diagnostics", function() {
result.runtime.settings.should.have.property("uiPort", "SET"); //should be sanitised to "SET" result.runtime.settings.should.have.property("uiPort", "SET"); //should be sanitised to "SET"
result.runtime.settings.should.have.property("userDir", "SET"); //should be sanitised to "SET" result.runtime.settings.should.have.property("userDir", "SET"); //should be sanitised to "SET"
result.runtime.settings.should.have.property('contextStorage').type("object"); result.runtime.settings.should.have.property('contextStorage').type("object");
result.runtime.settings.should.have.property('nodesDir', "SET")
//result.runtime.settings.contextStorage.xxxxx //result.runtime.settings.contextStorage.xxxxx
const contextCount = Object.keys(result.runtime.settings.contextStorage).length; const contextCount = Object.keys(result.runtime.settings.contextStorage).length;