Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Cosmos] Extract a StoreResult test factory to replace the 20-arg positional constructor in unit tests

オープン
#49,433 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@mbhaskar がすでに取り組んでいます。

2026年6月9日 から。

評価

この issue はまだ評価されていません。

説明

Cosmos

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 StoreResult constructor 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.java
  • sdk/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."

主要言語
Java
スター
2.6k
フォーク
2.2k
平均マージ
1日 22時間
マージ済み PR(30日)
220

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Azure/azure-sdk-for-java のほかの issue

Azure/azure-sdk-for-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。