fix(ui): показывать ошибки и свежесть NetFlow карты

This commit is contained in:
Denozordec committed 2026-10-01 01:56:39 +07:00
1 parent e47e2b4029
commit 1bce4e1ea2
7 files changed
+139 -45

No files matched your search

+16
View File
@@ -13,3 +13,19 @@ test("network map refuses partial GRE and foreign failure/probe contexts",()=>{
const probe={id:"p",srcServerId:"1",dstServerId:"2",srcInterface:"",dstInterface:"",enabled:true,lastTxAvgMbps:null,lastRxAvgMbps:null,lastPingRttMs:null,lastPingLossPct:null,lastPingAt:null}
assert.throws(()=>validateNetworkMapSnapshot([server],{tunnels:[]},{probes:[probe]}),/неизвестному/)
})
import {networkMapFlowSchema,validateNetworkMapDns} from "./network-map-response"
test("map Flow envelope retains zeros and refuses missing metadata and contradictory totals",()=>{
const empty={"hops":[],"live":false,"rangeMinutes":5,"windowSec":300,"totalBytes":0,"namedBytes":0,"unclassifiedBytes":0,"asnLoaded":false,"countryLoaded":false,"services":[],"serviceEdges":[],"servicePaths":[],"countries":[],"countryEdges":[],"countryPaths":[],"countryServiceGroups":[],"mapServiceMinSharePct":5,"dedupApplied":false,"excludeMeshApplied":false,"excludeOverlayApplied":false}
assert.equal(networkMapFlowSchema.parse(empty).totalBytes,0)
assert.equal(networkMapFlowSchema.parse(empty).live,false)
assert.throws(()=>networkMapFlowSchema.parse({...empty,totalBytes:undefined}))
assert.throws(()=>networkMapFlowSchema.parse({...empty,namedBytes:1}))
assert.throws(()=>networkMapFlowSchema.parse({...empty,rangeMinutes:10}))
})
test("map DNS matches exactly requested names and accepts explicit unresolved null",()=>{
assert.deepEqual(validateNetworkMapDns({results:{"router.example":null}},["router.example"]),{"router.example":null})
assert.throws(()=>validateNetworkMapDns({results:{}},["router.example"]))
assert.throws(()=>validateNetworkMapDns({results:{"foreign.example":"192.0.2.1"}},["router.example"]))
assert.throws(()=>validateNetworkMapDns({results:{"router.example":"not-ip"}},["router.example"]))
})