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

Aperta Adatta ai principianti
#2,916 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, postgresql, rust, shell
Ambito
backend, testing

Direzione di ricerca

Leggi products/messaging/scripts/test-dev.sh e individua dove controlla la metrica messaging_provider_callbacks_total{outcome="applied"} dopo aver atteso lo stato dell’SMS. Interroga la metrica a intervalli regolari durante l’attesa limitata esistente, mantieni il conteggio atteso a 1 e, in caso di timeout, indica l’ultimo valore. Esegui lo script con Docker, poi controllalo con ShellCheck e shfmt -d; il lavoro è completato quando il controllo attende il contatore e continua a rifiutare i callback duplicati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Rust
Stelle
2
Fork
0
Merge medio
13h 7m
PR unite (30g)
119

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di registrystack/registry-stack

Tutte le issue di registrystack/registry-stack

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.