perf(go): cache identity binding lookups

This commit is contained in:
lingniu
2026-07-03 08:07:32 +08:00
parent 0b9e803139
commit 400047e08c
5 changed files with 83 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
package main
import (
"os"
"strings"
"testing"
"lingniu-vehicle-ingest/go/vehicle-gateway/internal/envelope"
@@ -32,6 +34,18 @@ func TestNATSSinkConfigFromEnvUsesExplicitSubjects(t *testing.T) {
}
}
func TestGatewayConfiguresIdentityLookupCacheTTL(t *testing.T) {
source, err := os.ReadFile("main.go")
if err != nil {
t.Fatalf("read main.go: %v", err)
}
for _, want := range []string{"LookupCacheTTL", "IDENTITY_LOOKUP_CACHE_TTL_SECONDS"} {
if !strings.Contains(string(source), want) {
t.Fatalf("gateway should expose identity lookup cache ttl, missing %s", want)
}
}
}
func TestNATSSinkConfigFromEnvDefaultsToGoSubjects(t *testing.T) {
t.Setenv("NATS_URL", "nats://172.17.111.56:4222")