mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 22:46:38 +08:00
9491b2a744
Migrate risk_control audit logs to internal/db/batchwriter and add openflare/chwriter with per-table async flush for observability timeseries and node access logs. Replace single-row ClickHouse inserts and pre-insert SELECT count() dedup with repository BatchInsert* APIs, in-process TTL dedup for metric/report snapshots, and bootstrap initialization on API startup.
24 lines
556 B
Go
24 lines
556 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package chwriter
|
|
|
|
import "testing"
|
|
|
|
func TestDedupSetMarkIfNew(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
set := newDedupSet()
|
|
if !set.markIfNew("node-a|1") {
|
|
t.Fatal("markIfNew() = false, want true on first key")
|
|
}
|
|
if set.markIfNew("node-a|1") {
|
|
t.Fatal("markIfNew() = true, want false on duplicate key")
|
|
}
|
|
if !set.markIfNew("node-b|1") {
|
|
t.Fatal("markIfNew() = false, want true on different key")
|
|
}
|
|
if set.markIfNew("") {
|
|
t.Fatal("markIfNew() = true, want false on empty key")
|
|
}
|
|
} |