mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-28 05:46:36 +08:00
160e63558f
Honest TTL cleanup semantics; enqueue-safe dedup with flush retry and writer metrics; model insert hooks; latest-per-node and hourly metric/openresty rollups; small-host pool/async defaults, traffic hourly TTL, and UV labeling.
31 lines
720 B
Go
31 lines
720 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package risk_control
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestAccessLogMaxFlushWaitInRange(t *testing.T) {
|
|
t.Parallel()
|
|
if accessLogMaxFlushWait < 2*time.Second || accessLogMaxFlushWait > 5*time.Second {
|
|
t.Fatalf("accessLogMaxFlushWait = %v, want in [2s, 5s]", accessLogMaxFlushWait)
|
|
}
|
|
}
|
|
|
|
func TestLogWriterStatsWhenNil(t *testing.T) {
|
|
t.Parallel()
|
|
reset := SetLogWriterForTest(nil)
|
|
t.Cleanup(reset)
|
|
|
|
stats := LogWriterStats()
|
|
if stats.Name != "user_access_logs" {
|
|
t.Fatalf("LogWriterStats().Name = %q, want user_access_logs", stats.Name)
|
|
}
|
|
if stats.Running {
|
|
t.Fatal("LogWriterStats().Running = true for nil writer, want false")
|
|
}
|
|
}
|