[Cosmos] Extract a StoreResult test factory to replace the 20-arg positional constructor in unit tests
Maintainer thường phản hồi trong vòng 1 ngày
@mbhaskar đang làm issue này rồi.
Từ ngày 9/6/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
Follow-up from PR #48914 (review feedback from @kushagraThapar).
The 20-arg positional new StoreResult(...) constructor is repeated across many test methods (in ConsistencyWriterTest.java at lines ~667, 725, 757, 779, 834, 894, 903, 919, 947, and several more in QuorumReaderTest.java). Each invocation follows the same pattern: most arguments are constants/null/false, with only 2–3 meaningful per test (replica role, isThrottledException, isValid).
This positional-constructor accretion has been growing across multiple PRs and makes tests verbose and fragile.
Proposed change
Extract a StoreResultTestFactory (or builder) with named, intent-revealing methods, e.g.:
throttled429()valid(int globalCommittedLsn)unhealthy(replicaRole)
Benefits:
- New tests become 1-line setup instead of ~20-line setup.
- When the
StoreResultconstructor changes (e.g. adding a 21st arg), only the factory updates instead of N test sites. - Test intent becomes self-documenting (
throttled429()reads as a behavior, not a 20-arg ctor invocation).
Scope
Test-only refactor; no production behavior change. Update existing StoreResult-based tests in:
sdk/cosmos/azure-cosmos-tests/.../directconnectivity/ConsistencyWriterTest.javasdk/cosmos/azure-cosmos-tests/.../directconnectivity/QuorumReaderTest.java
Context
Reviewer noted this is "not a blocker for [PR #48914] but worth scheduling as a follow-up before the next test wave lands on top."
- Ngôn ngữ chính
- Java
- Star
- 2.6k
- Fork
- 2.2k
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 213
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/azure-sdk-for-java
-
mgmt, in track 1 migration guide, call out that file-based authentication method is not recommendedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởAzure.Identity
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
Azure/azure-sdk-for-java#48894 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] - Handler.close livelocks on FAIL_NON_SERIALIZED while holding the ReactorConnection monitorCó thể đã có người làm @conniey đã nhận 1 ngày trước. Đang mởAzure.Core.AMQP Client customer-reported needs-team-attention question
Azure/azure-sdk-for-java#50879 · 2 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Design] Support External Evaluation Policy (Invoke) in management SDKsCó thể đã có người làm @weidongxu-microsoft đã nhận 6 ngày trước. Đang mở
Azure/azure-sdk-for-java#50818 · 2 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] azure-core-http-vertx: Streaming request bodies hang on Vert.x 5.x (NoSuchMethodError on HttpClientRequest.reset)Có thể đã có người làm @alzimmermsft đã nhận 6 ngày trước. Đang mởAzure.Core Client customer-reported needs-team-attention question
Azure/azure-sdk-for-java#50793 · 6 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE REQ] ChangeFeedProcessor event handler fully reactive implementationCó thể đã có người làm @FabianMeiswinkel đã nhận 7 ngày trước. Đang mởClient Cosmos customer-reported feature-request needs-team-attention Service Attention
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Azure/azure-sdk-for-java#50758 · 3 bình luận · 1 reaction · 2 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/azure-sdk-for-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/rocketmq-dashboard#7302 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
area: android good first issue help wanted testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Gautam-aman/ResQNet#56 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation hermes-queue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
chrisalunlloyd2-sudo/mindpalace#294 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
better night vision compatĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
QuicksilverMC/Argentum#31 ·