fix the test case

This commit is contained in:
tong3jie 2026-03-16 14:40:27 +08:00
parent 4ae9604043
commit b2237cb144

View file

@ -34,11 +34,19 @@ func TestHandleC2CMessage_IncludesAccountIDMetadata(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second) ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel() defer cancel()
inbound, ok := messageBus.ConsumeInbound(ctx) for {
if !ok { select {
t.Fatal("expected inbound message") case <-ctx.Done():
} t.Fatal("timeout waiting for inbound message")
if inbound.Metadata["account_id"] != "7750283E123456" { return
t.Fatalf("account_id metadata = %q, want %q", inbound.Metadata["account_id"], "7750283E123456") case inbound, ok := <-messageBus.InboundChan():
if !ok {
t.Fatal("expected inbound message")
}
if inbound.Metadata["account_id"] != "7750283E123456" {
t.Fatalf("account_id metadata = %q, want %q", inbound.Metadata["account_id"], "7750283E123456")
}
return
}
} }
} }