fix(netflow): исправить расчёт отдачи и загрузку карты сети
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m56s
Docker images / frontend-image (push) Successful in 2m23s
Docker images / updater-image (push) Successful in 40s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 2m5s
Docker images / publish-release (push) Successful in 17s
Docker images / notify-webhook (push) Successful in 3s
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 10m56s
Docker images / frontend-image (push) Successful in 2m23s
Docker images / updater-image (push) Successful in 40s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 2m5s
Docker images / publish-release (push) Successful in 17s
Docker images / notify-webhook (push) Successful in 3s
This commit is contained in:
1 parent
e6b2108f79
commit
87461daa42
12 files changed
+147
-61
No files matched your search
@@ -39,6 +39,12 @@ test("map Flow envelope retains zeros and refuses missing metadata and contradic
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...empty,totalBytes:undefined}))
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...empty,namedBytes:1}))
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...empty,rangeMinutes:10}))
|
||||
const shorter={...empty,rangeMinutes:2,windowSec:120,sourceWindow:{requestedMinutes:5,effectiveMinutes:2}}
|
||||
assert.equal(networkMapFlowSchema.parse(shorter).rangeMinutes,2)
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...shorter,sourceWindow:undefined}))
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...shorter,sourceWindow:{requestedMinutes:15,effectiveMinutes:2}}))
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...shorter,rangeMinutes:1,windowSec:60}))
|
||||
assert.throws(()=>networkMapFlowSchema.parse({...shorter,windowSec:300}))
|
||||
})
|
||||
test("map DNS matches exactly requested names and accepts explicit unresolved null",()=>{
|
||||
assert.deepEqual(validateNetworkMapDns({results:{"router.example":null}},["router.example"]),{"router.example":null})
|
||||
|
||||
@@ -27,7 +27,13 @@ export function validateNetworkMapSnapshot(servers:unknown,gre:unknown,probes:un
|
||||
|
||||
import {flowMapHopsDtoSchema} from "@mmapp/contracts/traffic-flow"
|
||||
import {isIpv4String} from "./gre-endpoint-resolve"
|
||||
export const networkMapFlowSchema=flowMapHopsDtoSchema.required().refine(data=>data.rangeMinutes===5&&data.namedBytes<=data.totalBytes&&data.unclassifiedBytes<=data.totalBytes)
|
||||
export const networkMapFlowSchema = flowMapHopsDtoSchema.required().partial({ sourceWindow: true }).refine(data =>
|
||||
(data.sourceWindow
|
||||
? data.sourceWindow.requestedMinutes === 5 && data.sourceWindow.effectiveMinutes === data.rangeMinutes
|
||||
: data.rangeMinutes === 5) &&
|
||||
data.windowSec === data.rangeMinutes * 60 &&
|
||||
data.namedBytes <= data.totalBytes && data.unclassifiedBytes <= data.totalBytes
|
||||
)
|
||||
export function validateNetworkMapDns(raw:unknown,hosts:string[]){
|
||||
const data=z.object({results:z.record(z.string(),z.string().refine(isIpv4String).nullable())}).parse(raw)
|
||||
const requested=new Set(hosts.map(host=>host.toLowerCase()))
|
||||
|
||||
Reference in new issue
Block a user