fix(snmp): stabilize SNMP test and require testcontainers 11.5.0

This commit is contained in:
dipok-1 2026-01-17 23:39:45 +06:00
parent 4929fbbe1e
commit 317f71cd68
3 changed files with 709 additions and 578 deletions

1274
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -207,7 +207,7 @@
"stylelint-config-standard": "~25.0.0",
"terser": "~5.15.0",
"test": "~3.3.0",
"testcontainers": "^10.13.1",
"testcontainers": "^11.5.0",
"typescript": "~4.4.4",
"v-pagination-3": "~0.1.7",
"vite": "~5.4.15",

View File

@ -12,16 +12,15 @@ describe("SNMPMonitorType", () => {
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();
try {
// Dynamically retrieve the assigned host port and IP
const hostPort = container.getMappedPort(161);
// Get the mapped UDP port
const hostPort = container.getMappedPort("161/udp");
const hostIp = container.getHost();
// UDP service small wait to ensure snmpd is ready inside container
await new Promise((r) => setTimeout(r, 1500));
await new Promise((r) => setTimeout(r, 2000));
const monitor = {
type: "snmp",
@ -33,8 +32,8 @@ describe("SNMPMonitorType", () => {
timeout: 5,
maxretries: 1,
jsonPath: "$",
jsonPathOperator: "exists",
expectedValue: null,
jsonPathOperator: "!=",
expectedValue: "",
};
const snmpMonitor = new SNMPMonitorType();