Initial commit: RouteWatch BGP stream monitor
- Connects to RIPE RIS Live stream to receive real-time BGP updates - Stores BGP data in SQLite database: - ASNs with first/last seen timestamps - Prefixes with IPv4/IPv6 classification - BGP announcements and withdrawals - AS-to-AS peering relationships from AS paths - Live routing table tracking active routes - HTTP server with statistics endpoints - Metrics tracking with go-metrics - Custom JSON unmarshaling to handle nested AS sets in paths - Dependency injection with uber/fx - Pure Go implementation (no CGO) - Includes streamdumper utility for debugging raw messages
This commit is contained in:
34
internal/streamer/streamer_test.go
Normal file
34
internal/streamer/streamer_test.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package streamer
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.eeqj.de/sneak/routewatch/internal/metrics"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
func TestNewStreamer(t *testing.T) {
|
||||
logger := slog.Default()
|
||||
metricsTracker := metrics.New()
|
||||
s := New(logger, metricsTracker)
|
||||
|
||||
if s == nil {
|
||||
t.Fatal("New() returned nil")
|
||||
}
|
||||
|
||||
if s.logger != logger {
|
||||
t.Error("logger not set correctly")
|
||||
}
|
||||
|
||||
if s.client == nil {
|
||||
t.Error("HTTP client not initialized")
|
||||
}
|
||||
|
||||
if s.handlers == nil {
|
||||
t.Error("handlers slice not initialized")
|
||||
}
|
||||
|
||||
if s.metrics != metricsTracker {
|
||||
t.Error("metrics tracker not set correctly")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user