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

Đang mở Phù hợp với người mới
#13,969 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 2 ngày

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

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
90/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ệ
python
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu tại tests/uranium_tests/h3/test_h3_python_client.py và kiểm tra cách wait_for_file_lines đối chiếu các dòng trong access log. Đặt mục tiêu chờ là các mục py-get-empty và py-put-large mà các assertion kiểm tra; hoàn tất khi bài kiểm thử chờ cả hai mục và các assertion đều đạt.

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

Mô tả

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.

Ngôn ngữ chính
C++
Star
2k
Fork
903
Merge trung bình
4 ngày 4 giờ
Pull request đã merge (30 ngày)
135

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

Tất cả issue của apache/trafficserver

Issue tương tự

Thêm issue về C++

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.