urtest: test_h3_python_client reads the access log before all entries are written

Aperta Adatta ai principianti
#13,969 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
90/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Inizia da tests/uranium_tests/h3/test_h3_python_client.py e verifica come wait_for_file_lines abbina le righe del log di accesso. Fai in modo che l’attesa punti alle voci py-get-empty e py-put-large verificate dalle asserzioni; il lavoro è completato quando il test attende entrambe le voci e le asserzioni passano.

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

Descrizione

tests/uranium_tests/h3/test_h3_python_client.py waits for any two c_alpn=h3 access-log lines, then asserts that the log contains the py-get-empty and py-put-large entries:

content = wait_for_file_lines(_ats.log_directory / "h3_python_access.log", r"c_alpn=h3", 2)
assert re.search(r"... c_method=GET c_url=https://py\.example\.com:[0-9]+/py-get-empty", content)
assert re.search(r"... c_method=PUT c_url=https://py\.example\.com:[0-9]+/py-put-large", content)

Since #13891 set proxy.config.log.max_secs_per_buffer and proxy.config.log.periodic_tasks_interval to 1 s, the access log reaches disk in several small writes. The wait can return after a write that holds py-get-empty but not yet py-put-large, and the second assertion fails:

AssertionError: assert None
 +  where None = re.search('c_alpn=h3 client_version=http/3 c_method=PUT c_url=https://py\\.example\\.com:[0-9]+/py-put-large',
    'c_alpn=h3 ... c_method=GET c_url=https://py.example.com:10009/py-get-empty\n
     c_alpn=h3 ... /py-get-large\n
     c_alpn=h3 ... c_method=POST c_url=https://py.example.com:10009/py-post-large\n')

In a Fedora 44 container (ci-fedora-urtest) it fails 4 of 5 runs in isolation. Without #13891, the 5 s flush writes every entry at once and the test passed 5 of 5.

Waiting for the two entries the test checks, rather than any two, fixes it: it passed 8 of 8 runs with no added runtime.

-    content = wait_for_file_lines(_ats.log_directory / "h3_python_access.log", r"c_alpn=h3", 2)
+    content = wait_for_file_lines(_ats.log_directory / "h3_python_access.log", r"c_alpn=h3 .*/py-(get-empty|put-large)$", 2)

This affects master and 10.2.x, which has #13891 for the 10.2.2 release.

Lingua principale
C++
Stelle
2k
Fork
903
Merge medio
4g 4h
PR unite (30g)
135

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 apache/trafficserver

Tutte le issue di apache/trafficserver

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.