chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)

This commit is contained in:
MiFaZhan
2026-11-02 13:27:59 +08:00
1250 changed files with 154111 additions and 0 deletions
@@ -0,0 +1,32 @@
package tasks
import (
"testing"
"time"
)
func TestTrafficUsageMonthlyTaskRegistrations(t *testing.T) {
tests := map[string]string{
"sync_traffic_usage_monthly": "SyncTrafficUsageMonthly",
"start_traffic_usage_full_sync": "StartTrafficUsageFullSync",
}
for name, method := range tests {
if actual := GetInnerTaskName(name); actual != method {
t.Fatalf("task %q registered as %q, want %q", name, actual, method)
}
}
}
func TestTrafficUsageJobLockUsesStableActiveScope(t *testing.T) {
first := time.Date(2026, 9, 20, 23, 59, 0, 0, time.Local)
second := first.Add(2 * time.Minute)
if got := jobLockPeriodKey(first, -1); got != "active" {
t.Fatalf("first active key = %q", got)
}
if got := jobLockPeriodKey(second, -1); got != "active" {
t.Fatalf("second active key = %q", got)
}
if jobLockKey("sync_traffic_usage_daily", first, -1) != jobLockKey("sync_traffic_usage_daily", second, -1) {
t.Fatal("active job lock key must remain stable across midnight")
}
}