fix(traffic): починить сборку tsc для частичных IPFIX-фикстур
Docker images / prepare-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 1m50s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 47s
Docker images / publish-release (push) Successful in 11s
Docker images / prepare-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 1m50s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 47s
Docker images / publish-release (push) Successful in 11s
Тесты не должны попадать в Docker tsc; ingest принимает ParsedFlowInput и нормализует поля. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import type Database from "better-sqlite3"
|
import type Database from "better-sqlite3"
|
||||||
import { normalizeParsedFlow, parseFlowPacket, protoName, type ParsedFlow } from "./traffic-flow-parse.js"
|
import { normalizeParsedFlow, parseFlowPacket, protoName, type ParsedFlow, type ParsedFlowInput } from "./traffic-flow-parse.js"
|
||||||
import { classifyFlowPlaneLite } from "./traffic-flow-planes.js"
|
import { classifyFlowPlaneLite } from "./traffic-flow-planes.js"
|
||||||
import { pickServerIdForExporter, type OverlayPeerRef } from "./traffic-flow-map-exporter.js"
|
import { pickServerIdForExporter, type OverlayPeerRef } from "./traffic-flow-map-exporter.js"
|
||||||
import { applicationName } from "./traffic-flow-apps.js"
|
import { applicationName } from "./traffic-flow-apps.js"
|
||||||
@@ -232,7 +232,7 @@ export function getEngineStats(): EngineStats {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function queueParsedFlows(serverId: number, flows: ParsedFlow[]): void {
|
export function queueParsedFlows(serverId: number, flows: ParsedFlowInput[]): void {
|
||||||
const bucketAt = minuteBucketIso()
|
const bucketAt = minuteBucketIso()
|
||||||
const ripeMisses: string[] = []
|
const ripeMisses: string[] = []
|
||||||
for (const raw of flows) {
|
for (const raw of flows) {
|
||||||
@@ -714,7 +714,7 @@ export function onEngineTick(): void {
|
|||||||
flushPending()
|
flushPending()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ingestParsedFlowsForServerForTests(serverId: number, flows: ParsedFlow[]): void {
|
export function ingestParsedFlowsForServerForTests(serverId: number, flows: ParsedFlowInput[]): void {
|
||||||
queueParsedFlows(serverId, flows)
|
queueParsedFlows(serverId, flows)
|
||||||
rollFlowRings()
|
rollFlowRings()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { beginSqliteExclusiveOp, db, endSqliteExclusiveOp, sqliteDatabase } from
|
|||||||
import { env } from "../config.js"
|
import { env } from "../config.js"
|
||||||
import { flowBuckets, servers } from "../db/schema.js"
|
import { flowBuckets, servers } from "../db/schema.js"
|
||||||
import type { FlowPurgeDto, FlowStatsDto, FlowTalkerDto } from "@mmapp/contracts/traffic-flow"
|
import type { FlowPurgeDto, FlowStatsDto, FlowTalkerDto } from "@mmapp/contracts/traffic-flow"
|
||||||
import { protoName, type ParsedFlow } from "./traffic-flow-parse.js"
|
import { protoName, type ParsedFlowInput } from "./traffic-flow-parse.js"
|
||||||
import type { CollectorHeartbeat, ExporterMapPayload, MainToWorker, WorkerToMain } from "./traffic-flow-collector-ipc.js"
|
import type { CollectorHeartbeat, ExporterMapPayload, MainToWorker, WorkerToMain } from "./traffic-flow-collector-ipc.js"
|
||||||
import {
|
import {
|
||||||
attachEngineSqlite,
|
attachEngineSqlite,
|
||||||
@@ -404,7 +404,7 @@ export function listFlowTalkers(minutes = 5): FlowStatsDto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ingestParsedFlowsForTests(exporterIp: string, flows: ParsedFlow[]) {
|
export function ingestParsedFlowsForTests(exporterIp: string, flows: ParsedFlowInput[]) {
|
||||||
applyExporterCtxFromDb()
|
applyExporterCtxFromDb()
|
||||||
const serverId = resolveServerId(exporterIp)
|
const serverId = resolveServerId(exporterIp)
|
||||||
if (serverId == null) return
|
if (serverId == null) return
|
||||||
@@ -413,7 +413,7 @@ export function ingestParsedFlowsForTests(exporterIp: string, flows: ParsedFlow[
|
|||||||
flushPending()
|
flushPending()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ingestParsedFlowsForServerForTests(serverId: number, flows: ParsedFlow[]) {
|
export function ingestParsedFlowsForServerForTests(serverId: number, flows: ParsedFlowInput[]) {
|
||||||
engineIngestForServer(serverId, flows)
|
engineIngestForServer(serverId, flows)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ export interface ParsedFlow {
|
|||||||
natDst: string
|
natDst: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ParsedFlowInput = Partial<ParsedFlow> & Pick<ParsedFlow, "src" | "dst" | "proto" | "bytes">
|
||||||
|
|
||||||
export function emptyParsedFlow(): ParsedFlow {
|
export function emptyParsedFlow(): ParsedFlow {
|
||||||
return {
|
return {
|
||||||
src: "",
|
src: "",
|
||||||
@@ -34,7 +36,7 @@ export function emptyParsedFlow(): ParsedFlow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeParsedFlow(flow: Partial<ParsedFlow> & Pick<ParsedFlow, "src" | "dst" | "proto" | "bytes">): ParsedFlow {
|
export function normalizeParsedFlow(flow: ParsedFlowInput): ParsedFlow {
|
||||||
return {
|
return {
|
||||||
...emptyParsedFlow(),
|
...emptyParsedFlow(),
|
||||||
...flow,
|
...flow,
|
||||||
|
|||||||
@@ -15,5 +15,5 @@
|
|||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist", "src/**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user