Add unit tests for status and condition helper functions
@aviralgarg05 がすでに取り組んでいます。
2026年11月9日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 68/100
調査の方向性
まず、api/v1alpha1/apikey_types.go と internal/controller/*.go にある対象のヘルパーと controller 関数を読み、次に近くにあるテストの規約を確認します。envtest を使わずに、指定された通常、nil、境界、分岐、比較、deep-copy のケースに対する unit test を追加します。make test を実行し、すべてのテストがパスすることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Summary
Write unit tests for the pure functions that check, compare, and build Kubernetes status conditions. These are critical to the controller's decision-making and are all testable without envtest.
Testing Guidance
For each function, think about:
- What does it return for normal, expected input?
- What happens at the boundaries — nil conditions, empty slices, missing fields?
- If there's branching logic, have you covered each branch?
Scope
api/v1alpha1/apikey_types.go
IsApproved()— checks whether an APIKey has an "Approved" condition set to True. Consider: condition present and True, condition present and False, no conditions at all, nil status.
internal/controller/apiproduct_helper.go
IsAuthPolicyAcceptedAndEnforced()— returns true only when both Accepted and Enforced conditions are True. Think about each combination: both true, one true, neither, nil policy.IsAuthPolicyAccepted(),IsAuthPolicyEnforced()— individual condition checks.IsAuthPolicyConditionTrue()— generic condition checker. Handles nil policy — test that path.
internal/controller/apiproduct_controller.go
authPolicyDiscoveredCondition()— builds a condition reflecting whether an AuthPolicy was found and is accepted+enforced. Test with nil policy, found but not enforced, and fully healthy.openAPISpecReadyCondition()— builds a condition for OpenAPI spec readiness. Has three paths: no URL configured (returns nil), fetch error, and success.oidcDiscoveredCondition()— builds a condition for OIDC discovery. Has three paths: no auth scheme, fetch error, and success.
internal/controller/apikey_status_controller.go
getInvalidReason()— returns a reason string from a condition, or a default if nil. Simple null-safe getter.
internal/controller/apikeyrequest_status_controller.go
conditionsEqual()— compares two condition slices ignoringLastTransitionTime. Think about: same conditions, different order, different status, empty slices, nil.copyConditions()— deep copies a condition slice. Verify the copy is independent of the original (mutating the copy shouldn't affect the source).
Review & Verification
PRs should include:
- How to review the changes (areas of interest, suggested review order)
- Steps to confirm locally:
make testruns and passes
- 主要言語
- Go
- スター
- 3
- フォーク
- 15
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Kuadrant/developer-portal-controller のほかの issue
-
documentation linkinator-failure
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
Add reference documentation for APIKeyRequest CRD対応中かも @amalsaidov が 18 日前に担当しました。 オープンdocumentation good first issue triage/accepted
難易度 2/5 半日 初心者へのやさしさ 74/100
-
triage/accepted
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Kuadrant/developer-portal-controller#83 · コメント 1 件 ·
-
Add unit tests for name generation, data transformation, and object helpers再び着手できるかも @VISHNU0906 が 19 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement good first issue triage/accepted
難易度 4/5 3〜5日 初心者へのやさしさ 72/100
Kuadrant/developer-portal-controller#76 · コメント 1 件 ·
-
enhancement maintainers-only
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Kuadrant/developer-portal-controller の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mattermost/mattermost-plugin-jira#1397 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add Free CS Systems Workshops, Starter Scaffolds & Zero-Dependency Verification CLI to CS Seriesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
docs: Route53 EKS Terraform example uses outdated EKS module arguments in main.tf対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
nutmos/expensetrackr#235 ·
メンテナーはふだん 1 日以内に返信