Files
bruno 4e1d7cd94a Add config validation and dashboard
Add YAML config loading with validation, env overrides for secrets, and
a web dashboard exposing health, stats, and recent events.
2026-08-03 12:12:12 -04:00

60 lines
1.0 KiB
V

module main
import sources
fn test_dedup_allows_first_event() {
mut d := new_dedup(DedupConfig{
enabled: true
ttl_seconds: 300
rate_limit: RateLimitConfig{
max_per_minute: 10
max_per_source: 30
}
})
event := sources.Event{
source: 'generic'
name: 'test'
topic: 'test'
message: 'hello'
}
assert d.allow(event) == true
}
fn test_dedup_blocks_duplicate() {
mut d := new_dedup(DedupConfig{
enabled: true
ttl_seconds: 300
rate_limit: RateLimitConfig{
max_per_minute: 10
max_per_source: 30
}
})
event := sources.Event{
source: 'generic'
name: 'test'
topic: 'test'
message: 'hello'
}
assert d.allow(event) == true
assert d.allow(event) == false
}
fn test_dedup_disabled() {
mut d := new_dedup(DedupConfig{
enabled: false
ttl_seconds: 300
rate_limit: RateLimitConfig{
max_per_minute: 10
max_per_source: 30
}
})
event := sources.Event{
source: 'generic'
name: 'test'
topic: 'test'
message: 'hello'
}
assert d.allow(event) == true
assert d.allow(event) == true
}