test(messaging): wait for the applied callback counter in the dev end-to-end check

Đang mở Phù hợp với người mới
#2,916 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, postgresql, rust, shell
Lĩnh vực
backend, testing

Hướng nghiên cứu

Đọc products/messaging/scripts/test-dev.sh và tìm vị trí script kiểm tra metric messaging_provider_callbacks_total{outcome="applied"} sau khi chờ trạng thái SMS. Thăm dò metric định kỳ trong khoảng thời gian chờ có giới hạn hiện có, giữ số lượng mong đợi là 1 và báo giá trị cuối cùng nếu hết thời gian chờ. Chạy script bằng Docker, sau đó kiểm tra bằng ShellCheck và shfmt -d; hoàn tất khi bước kiểm tra chờ bộ đếm và vẫn từ chối các callback trùng lặp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What fails

products/messaging/scripts/test-dev.sh can fail in the Messaging PostgreSQL runtime CI job with:

test-dev: GET /v1/messages/<sms>: status delivered
test-dev: GET /v1/messages/<email>: status submitted
test-dev: Mailpit holds 1 message
test-dev: 0 signed callbacks were applied, expected 1

It failed once on pull request #2913, in a run whose changes touch no Messaging code or script. The same job passed on the previous two runs.

Why

The script waits, with a bound, until the SMS reads delivered. It then reads messaging_provider_callbacks_total{outcome="applied"} once.

The runtime records that counter after the callback is handled. In crates/registry-messaging/src/callbacks.rs, the handler awaits receive_callback, which commits the status change, and then calls state.metrics.record_callback(outcome). A status read that lands between the commit and the counter update sees delivered while the counter is still 0. The single metrics read then fails the check.

The runtime behaviour is fine: the counter is eventually correct, and nothing reads it as a commit signal. The check is too strict about ordering.

Proposed change

Read the applied counter inside the same kind of bounded wait the script already uses for the message status. For example, poll $dev_metrics every 0.5 seconds until the applied count is 1 or settle_seconds passes, then fail with the last value read.

Keep the exact expectation of 1, so a duplicate callback still fails the check.

Verification

  • products/messaging/scripts/test-dev.sh passes locally with Docker.
  • ShellCheck and shfmt -d are clean on the script.
  • Optional: inject a short delay before record_callback in a local build and confirm that the check waits rather than fails.
Ngôn ngữ chính
Rust
Star
2
Fork
0
Merge trung bình
13 giờ 7 phút
Pull request đã merge (30 ngày)
119

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của registrystack/registry-stack

Tất cả issue của registrystack/registry-stack

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.