sync: 同步 v1.0.4 并脱敏配置与镜像
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user