Add unit tests for status and condition helper functions
@aviralgarg05 đang làm issue này rồi.
Từ ngày 9/11/2026.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc các helper và hàm controller được liệt kê trong api/v1alpha1/apikey_types.go và internal/controller/*.go, sau đó kiểm tra các quy ước test ở gần đó. Thêm unit test cho các trường hợp thông thường, nil, biên, nhánh, so sánh và deep-copy được chỉ định mà không dùng envtest. Chạy make test và xác nhận rằng tất cả test đều pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Go
- Star
- 3
- Fork
- 15
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 4
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.
- Có Dockerfile hoặc tệp Docker Compose
- Không 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 Kuadrant/developer-portal-controller
-
documentation linkinator-failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Add reference documentation for APIKeyRequest CRDCó thể đã có người làm @amalsaidov đã nhận 19 ngày trước. Đang mởdocumentation good first issue triage/accepted
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 74/100
-
triage/accepted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Kuadrant/developer-portal-controller#83 · 1 bình luận ·
-
Add unit tests for name generation, data transformation, and object helpersCó thể làm lại được @VISHNU0906 đã nhận 19 ngày trước và không có pull request nào đang mở. Đang mởenhancement good first issue triage/accepted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 72/100
Kuadrant/developer-portal-controller#76 · 1 bình luận ·
-
enhancement maintainers-only
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Tất cả issue của Kuadrant/developer-portal-controller
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
alibaba/MongoShake#1077 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mattermost/mattermost-plugin-jira#1397 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Add Free CS Systems Workshops, Starter Scaffolds & Zero-Dependency Verification CLI to CS SeriesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100