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

Offen Anfängerfreundlich
#13,969 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
90/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
testing

Rechercherichtung

Beginne in tests/uranium_tests/h3/test_h3_python_client.py und prüfe, wie wait_for_file_lines Zeilen im Access-Log zuordnet. Lass die Wartefunktion auf die Einträge py-get-empty und py-put-large warten, die von den Assertions geprüft werden; fertig ist die Änderung, wenn der Test auf beide Einträge wartet und die Assertions bestehen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
C++
Sterne
2k
Forks
903
Ø Merge
4 T. 4 Std.
Gemergte PRs (30 T.)
135

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/trafficserver

Alle Issues in apache/trafficserver

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.