From 523f6f433c1b280168ac46d409af08019c81b133 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 17 Jan 2026 12:14:21 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- server/monitor-types/snmp.js | 6 +----- src/pages/EditMonitor.vue | 16 +++++----------- test/backend-test/test-snmp.js | 27 ++++++--------------------- 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/server/monitor-types/snmp.js b/server/monitor-types/snmp.js index 7ed1ee218..719ec5f8f 100644 --- a/server/monitor-types/snmp.js +++ b/server/monitor-types/snmp.js @@ -29,11 +29,7 @@ class SNMPMonitorType extends MonitorType { // a follow-up PR to keep this change scoped. sessionOptions.securityLevel = snmp.SecurityLevel.noAuthNoPriv; sessionOptions.username = monitor.snmp_v3_username; - session = snmp.createV3Session( - monitor.hostname, - monitor.snmp_v3_username, - sessionOptions - ); + session = snmp.createV3Session(monitor.hostname, monitor.snmp_v3_username, sessionOptions); } else { session = snmp.createSession(monitor.hostname, monitor.radiusPassword, sessionOptions); } diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 54f6994c0..46e7679f7 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -509,20 +509,14 @@
+ />
diff --git a/test/backend-test/test-snmp.js b/test/backend-test/test-snmp.js index aa1bede7e..2dae1128d 100644 --- a/test/backend-test/test-snmp.js +++ b/test/backend-test/test-snmp.js @@ -9,15 +9,11 @@ describe("SNMPMonitorType", () => { test( "check() sets heartbeat to UP when SNMP agent responds", { - skip: - !!process.env.CI && - (process.platform !== "linux" || process.arch !== "x64"), + skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64"), }, async () => { // Expose SNMP port via Testcontainers - const container = await new GenericContainer("polinux/snmpd") - .withExposedPorts("161/udp") - .start(); + const container = await new GenericContainer("polinux/snmpd").withExposedPorts("161/udp").start(); try { // Dynamically retrieve the assigned host port and IP @@ -57,9 +53,7 @@ describe("SNMPMonitorType", () => { test( "check() throws when SNMP agent does not respond", { - skip: - !!process.env.CI && - (process.platform !== "linux" || process.arch !== "x64"), + skip: !!process.env.CI && (process.platform !== "linux" || process.arch !== "x64"), }, async () => { const monitor = { @@ -76,10 +70,7 @@ describe("SNMPMonitorType", () => { const snmpMonitor = new SNMPMonitorType(); const heartbeat = {}; - await assert.rejects( - () => snmpMonitor.check(monitor, heartbeat), - /timeout|RequestTimedOutError/i - ); + await assert.rejects(() => snmpMonitor.check(monitor, heartbeat), /timeout|RequestTimedOutError/i); } ); @@ -124,18 +115,12 @@ describe("SNMPMonitorType", () => { const snmpMonitor = new SNMPMonitorType(); const heartbeat = {}; - await assert.rejects( - () => snmpMonitor.check(monitor, heartbeat), - /stop test here/ - ); + await assert.rejects(() => snmpMonitor.check(monitor, heartbeat), /stop test here/); // Assertions assert.strictEqual(createV3Called, true); assert.strictEqual(createSessionCalled, false); - assert.strictEqual( - receivedOptions.securityLevel, - snmp.SecurityLevel.noAuthNoPriv - ); + assert.strictEqual(receivedOptions.securityLevel, snmp.SecurityLevel.noAuthNoPriv); // Restore originals snmp.createV3Session = originalCreateV3Session;