Files
urutau/internal/store/integrity_test.go
T
Lucas RayanandClaude Opus 5.5 2ebda1e4d7
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped
feat: 1.3.0 thirteen new pages, charts, tooltips and error analysis
New pages grouped in the rail (Monitor, Investigate, Analyze, Operate,
Reports): Services (SLO, Apdex, latency app vs proxy), Sessions (stage
funnel), Campaigns, Event search, MITRE ATT&CK matrix, Evolution,
Concentration (Pareto, Gini), Survival (Kaplan-Meier per attack
episode, recidivists), Where errors come from (application vs failed
attack vs proxy vs client), Protocols and TLS, Defense (fail2ban, SSH,
blocklist), Integrity, and a printable executive report.

Chart library (donut, radar, stacked area, bars, heatmap, gauge),
glossary with accessible "?" tooltips, self-explanatory category names
(nonexistent page 404), page loader through pages.json.

Unique visitors fixed: real browsers opening a page, one per IP per day,
deduplicated across domains, with non-human clients counted apart.
Anonymous legitimate visits on the Live page (?visits=1, no IP).
Traefik origin, service, protocol and TLS fields parsed. Paths and
Referer paths drop e-mail and token segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 22:39:33 -03:00

28 lines
731 B
Go

package store
import "testing"
func TestHourlyFromTimelineAndGaps(t *testing.T) {
tl := Timeline{Start: 0, Step: 1800, Series: map[string][]uint32{
"a": {1, 1, 0, 0, 0, 0, 0, 0, 2, 0},
"b": {0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
}}
h := HourlyFromTimeline(tl, 0, 5)
want := []uint32{3, 0, 0, 0, 2, 0}
for i := range want {
if h[i] != want[i] {
t.Fatalf("hourly %v", h)
}
}
g := FindGaps([]uint32{0, 2, 1, 0, 0, 0, 4, 0, 5, 0}, 10)
if len(g) != 1 || g[0].From != 13*3600 || g[0].To != 16*3600 {
t.Fatalf("gaps %+v", g)
}
if g := FindGaps([]uint32{0, 0, 5, 0, 0, 0}, 0); len(g) != 0 {
t.Fatalf("irregular source has no gaps: %+v", g)
}
if len(HourlyFromTimeline(tl, 5, 1)) != 0 {
t.Fatal("empty window")
}
}