feat: expand vehicle data platform capabilities
This commit is contained in:
@@ -50,3 +50,32 @@ func TestLoadKeepsExplicitMockDataMode(t *testing.T) {
|
||||
t.Fatalf("DataMode = %q, want mock", cfg.DataMode)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadReadsAlertNotificationDispatcherSettings(t *testing.T) {
|
||||
t.Setenv("ALERT_NOTIFICATION_TARGETS_JSON", `[{"id":"night-shift","label":"夜班负责人","channels":["sms"]}]`)
|
||||
t.Setenv("ALERT_NOTIFICATION_SMS_URL", "https://gateway.example.test/sms")
|
||||
t.Setenv("ALERT_NOTIFICATION_SMS_SECRET", "signing-secret")
|
||||
t.Setenv("ALERT_NOTIFICATION_BATCH_SIZE", "48")
|
||||
t.Setenv("ALERT_NOTIFICATION_POLL_INTERVAL_MS", "750")
|
||||
t.Setenv("ALERT_NOTIFICATION_LEASE_SEC", "45")
|
||||
t.Setenv("ALERT_NOTIFICATION_TIMEOUT_MS", "8000")
|
||||
|
||||
cfg := Load()
|
||||
if cfg.AlertNotificationTargetsJSON == "" || cfg.AlertNotificationSMSURL != "https://gateway.example.test/sms" || cfg.AlertNotificationSMSSecret != "signing-secret" {
|
||||
t.Fatalf("notification target or gateway settings were not loaded: %+v", cfg)
|
||||
}
|
||||
if cfg.AlertNotificationBatchSize != 48 || cfg.AlertNotificationPollInterval != 750*time.Millisecond || cfg.AlertNotificationLease != 45*time.Second || cfg.AlertNotificationTimeout != 8*time.Second {
|
||||
t.Fatalf("notification worker timing settings were not loaded: %+v", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadReadsHistoryCleanupAutomationSettings(t *testing.T) {
|
||||
t.Setenv("HISTORY_EXPORT_CLEANUP_AUTOMATION_ENABLED", "true")
|
||||
t.Setenv("HISTORY_EXPORT_CLEANUP_POLL_SEC", "45")
|
||||
t.Setenv("HISTORY_EXPORT_CLEANUP_LEASE_SEC", "420")
|
||||
|
||||
cfg := Load()
|
||||
if !cfg.HistoryCleanupAutomation || cfg.HistoryCleanupPollInterval != 45*time.Second || cfg.HistoryCleanupLease != 7*time.Minute {
|
||||
t.Fatalf("history cleanup automation settings were not loaded: %+v", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user