Files
netwatch/backend/internal/reportbuf/export_test.go
T
clawbot 57b29df445
check / check (push) Successful in 2m18s
Go tests run with -race and -cover under Go's own timeout (closes #88)
backend/script/test runs go test -timeout 30s -race -cover and, if
that fails, runs it again with -v and fails. The root script/test drops
its one 30-second timeout around both halves: from a cold Go build
cache, compiling the tests with -race used it all up on four cores.
Each half keeps its own limit. The builder stage of the Dockerfile
gains gcc and musl-dev for the race detector; make build still sets
CGO_ENABLED=0. New tests: the health check's answer, a valid report's
answer, a report file's exact lines, and the flush at the 10 MiB
threshold. The handlers TestImport stub is gone.

Model: opus-5-5
2026-10-03 13:04:34 +00:00

20 lines
603 B
Go

package reportbuf
import "time"
// FlushSizeThreshold exposes the buffer size at which Append starts
// writing a report file to the external tests.
const FlushSizeThreshold = flushSizeThreshold
// Flush writes the buffered reports to a file now, as the periodic
// flush does, so tests need not wait a minute for it.
func (b *Buffer) Flush() error {
return b.flushLocked()
}
// StopClock makes every report file the buffer writes from now on
// carry the timestamp at, as if all were written in one millisecond.
func (b *Buffer) StopClock(at time.Time) {
b.now = func() time.Time { return at }
}