feat: build vehicle data platform and production pipeline
This commit is contained in:
27
go/vehicle-gateway/internal/gateway/identity_metrics_test.go
Normal file
27
go/vehicle-gateway/internal/gateway/identity_metrics_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/envelope"
|
||||
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/metrics"
|
||||
)
|
||||
|
||||
func TestRecordGatewayIdentityCacheStatus(t *testing.T) {
|
||||
registry := metrics.NewRegistry()
|
||||
recordGatewayIdentityCacheStatus(registry, envelope.ProtocolJT808, envelope.FrameEnvelope{
|
||||
Parsed: map[string]any{
|
||||
"identity": map[string]any{
|
||||
"resolved": true,
|
||||
"cache_status": "stale",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
got := registry.Render()
|
||||
want := `vehicle_gateway_identity_cache_total{cache_status="stale",protocol="JT808"} 1`
|
||||
if !strings.Contains(got, want) {
|
||||
t.Fatalf("metrics missing %q:\n%s", want, got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user