Add unit tests for name generation, data transformation, and object helpers
@VISHNU0906 已经在做这个了。
开始于 2026年11月11日。
评估
调研方向
从 internal/controller/devportal_helper.go、internal/controller/apikey_secret_controller.go、api/v1alpha1 类型文件以及 reconcilers 中列出的函数开始。阅读每个函数,并为 issue 中描述的正常、边界、分支、变更和往返场景添加单元测试覆盖。运行 make test;当所有要求的函数都已覆盖且测试套件通过时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Write unit tests for the pure functions that generate deterministic names, transform data between types, and manage object annotations. All testable without envtest.
Testing Guidance
For each function, think about:
- What does it return for normal, expected input?
- What happens at the boundaries — empty strings, nil objects, missing fields?
- If there's branching logic, have you covered each branch?
Scope
internal/controller/devportal_helper.go
APIKeyRequestName()— generates a DNS-1123 compliant name from an APIKey using a SHA-256 hash suffix. Think about: does the output meet DNS-1123 rules? Is it deterministic (same input = same output)? Different namespace/name combinations that could collide without the hash.
internal/controller/apikey_secret_controller.go
enforcementSecretName()— same pattern as above, generates a deterministic name for enforcement secrets. Same considerations apply.
api/v1alpha1/apikey_types.go
APIProductKey()— returns an ObjectKey for the referenced APIProduct, falling back to the APIKey's own namespace if the ref namespace is empty. Test the fallback behaviour.
api/v1alpha1/apikeyrequest_types.go
ClientObject()— converts an APIKeyReference to an ObjectKey. Straightforward struct conversion.
api/v1alpha1/apiproduct_types.go
PlanPolicyIntoPlans()— converts a PlanPolicy's plan list into PlanSpec slice. Test with nil input, empty plan list, and multiple plans.
internal/controller/apiproduct_controller.go
extractIssuerURLFromAuthScheme()— finds the first JWT issuer URL from an auth scheme. Consider: no authentication map, authentication with non-JWT entries, multiple JWT entries (which one wins?), nil auth scheme.
internal/controller/apikeyrequest_controller.go
apiKeyRequestSpecMutator()— compares existing vs desired specs, mutates existing if different, returns whether mutation occurred. Test: specs are equal (no mutation), specs differ (mutation happens), verify the existing object is actually updated.
internal/reconcilers/base_reconcilers.go
TagObjectToDelete()/IsObjectTaggedToDelete()— adds/checks a deletion annotation. Test: object with no annotations, object with existing annotations, round-trip (tag then check).
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 小时
- 30 天内合并 PR
- 4
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 status and condition helper functions可能重新可做 @aviralgarg05 于 21 天前认领,目前没有进行中的 PR。 未关闭enhancement good first issue triage/accepted
难度 4/5 3-5 天 新手友好度 68/100
Kuadrant/developer-portal-controller#75 · 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可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
nutmos/expensetrackr#235 ·
维护者通常 1 天内回复