fix(scan): two-phase progress + hosts_processed; clarify status at 99% SNMP tail

Made-with: Cursor
This commit is contained in:
PTah
2026-04-13 13:53:46 +10:00
parent 0de279926f
commit 70fff4f0ea
4 changed files with 93 additions and 18 deletions
+20
View File
@@ -0,0 +1,20 @@
package scans
import "testing"
func TestScanProgressBlend(t *testing.T) {
const total = 256
if g := scanProgressBlend(0, 0, total); g != 0 {
t.Fatalf("0,0 -> 0 got %d", g)
}
if g := scanProgressBlend(total, total-1, total); g != 99 {
t.Fatalf("quick=total full=total-1 -> 99 got %d", g)
}
if g := scanProgressBlend(total, total, total); g != 100 {
t.Fatalf("complete -> 100 got %d", g)
}
// типичный «застряли на последних SNMP»: ping по всем, SNMP не догнан
if g := scanProgressBlend(256, 253, total); g != 99 {
t.Fatalf("256,253 -> 99 got %d", g)
}
}