sync: 同步 v1.0.4 开源代码并脱敏

This commit is contained in:
MiFaZhan
2026-10-29 14:52:43 +08:00
parent 32e4316ee4
commit 6893e21f07
136 changed files with 9851 additions and 436 deletions
+8 -7
View File
@@ -300,7 +300,7 @@ func TestHandleWorkerDiagnostic(t *testing.T) {
message := model.WorkerDiagnosticMessage{
TraceID: "worker-test-1",
SentAt: 1780000000000,
SentAt: 1784030000000,
Message: "worker ping",
}
if err := consumers.handleWorkerDiagnostic(context.Background(), message); err != nil {
@@ -311,14 +311,14 @@ func TestHandleWorkerDiagnostic(t *testing.T) {
func TestWorkerDiagnosticMessageJSONContract(t *testing.T) {
message := model.WorkerDiagnosticMessage{
TraceID: "worker-test-1",
SentAt: 1780000000000,
SentAt: 1784030000000,
Message: "worker ping",
}
body, err := json.Marshal(message)
if err != nil {
t.Fatalf("marshal diagnostic message: %v", err)
}
const expected = `{"traceId":"worker-test-1","sentAt":1780000000000,"message":"worker ping"}`
const expected = `{"traceId":"worker-test-1","sentAt":1784030000000,"message":"worker ping"}`
if string(body) != expected {
t.Fatalf("unexpected diagnostic JSON: %s", body)
}
@@ -517,10 +517,11 @@ func TestMonthlyHistoryStartConsumerIsOptIn(t *testing.T) {
func TestConsumerInitializersRespectWorkerDiagnosticSwitch(t *testing.T) {
consumers := New(&trafficUsageHandlerStub{}, &workOrderHandlerStub{}, &balanceRechargeHandlerStub{})
if got := len(consumers.initializers(false)); got != 6 {
t.Fatalf("diagnostic disabled: expected 6 business consumers, got %d", got)
// 手动同步上游结果(initDataReviewQuery)随业务消费者常驻,无处理器时自跳过。
if got := len(consumers.initializers(false)); got != 7 {
t.Fatalf("diagnostic disabled: expected 7 business consumers, got %d", got)
}
if got := len(consumers.initializers(true)); got != 7 {
t.Fatalf("diagnostic enabled: expected 7 consumers, got %d", got)
if got := len(consumers.initializers(true)); got != 8 {
t.Fatalf("diagnostic enabled: expected 8 consumers, got %d", got)
}
}